add_action(‘the_content’, ‘my_plugin_content’) is null

Filters always return something, they’re not actions, they take something in, modify it, then return it, but your filter does neither.

As a result, PHP declares that it returned null, and the next filter along recieves null as the post content.

For example, this filter appends the word “Hey!” to the end of the content:

add_filter( 'the_content', function ( $content ) {
    return $content . 'Hey!';
} );

So here are things you need to keep in mind:

  • filters get called a lot, do not do heavy work in filters
  • filters are for filtering, you take the first parameter, do things to it, then return it
  • filters always return something
  • do not echo stuff out on a filter, you’re meant to return the full value with your modifications applied

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)