Remove filter of a plugin

admin

Administrator
Staff member
I have a review plugin that overrides the comment form in a specific posttype.
Now I'm trying to seperate the reviews and comments.

My first step is to remove the filter that modifies the current comment template and use that filter inside a second comment form.

The plugin uses this code (simplified)

Code:
final class DM_Reviews {

    public function hooks() {
        do_action_ref_array( 'dm_reviews_before_setup_actions', array( &$this ) );

        add_filter( 'comment_form_defaults', array( $this, 'reviews_form'       ) );        

        do_action_ref_array( 'dm_reviews_after_setup_actions', array( &$this ) );
    }

    public function review_form( $args ) {    

            $form = 'plugin code to modify form';   

        return wp_parse_args( $form, $args );
    }

}

In my child theme's function.php file, I tried to use this but it didn't worked.

Code:
global $DM_Reviews;
remove_filter( 'comment_form_defaults', array($DM_Reviews, 'reviews_form'),1 );

<a href="https://codex.wordpress.org/Function_Reference/remove_filter" rel="noreferrer">WP Codex</a>

If someone can put me in the right direction on how to solve it, it would help me a lot.