Remove filter of a plugin Remove filter of a plugin wordpress wordpress

Remove filter of a plugin


I think you can achieve this goal, using one of the following solutions depending on the way this plugin instantiates the class:

if( class_exists('DM_Reviews' ) ){  //This should work in whatever case, not tested  remove_filter('comment_form_defaults', array( 'DM_Reviews', 'reviews_form'));  //or Instantiating a new instance, not tested  remove_filter('comment_form_defaults', array( new DM_Reviews(), 'reviews_form'));  //or Targeting the specific instance, not tested  remove_filter('comment_form_defaults', array( DM_Reviews::get_instance(), 'reviews_form'));}

Hope it helps, let me know if you get stuck.


for me remove_filter didn't work from function.php i wanted to remove a specific behavior of a plugin so what i did :

add_action( 'init', 'remove_filters' );function remove_filters(){    global $wp_filter;    unset( $wp_filter["_filter_name"]);}


Try this :

$instance = DM_Reviews::this();remove_filter('comment_form_defaults', array( $instance, 'reviews_form'));