I just made a plugin with some meta data and such. I need to alter the content when, but my add_filter(‘the_content’) doesn’t do anything…

Code:

public function run() { 
    add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
    add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
    add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );

    add_action( 'save_post', array( $this, 'save_post' ) );
    add_filter( 'the_content', array( $this, 'some_content_method' ) );

}


public function some_content_method( $content ) {

    var_dump('Why u no?');
    $content .= 'Why u no work?';
    return $content;
}

If I write ‘add_meta_boxes’ the dump will work.

If I change it to add_action instead of add_filter nothing happens either – everything else works – can anybody help?

Read more here: add_filter the_content doesn’t work


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: