Empty string supplied as input when parsing content

I have this code:

<?php
function mb_find_my_image( $content ) {
    if( is_home() ) { /* if is home start */

      $dom = new domDocument;
      $dom->loadHTML($content);
      $dom->preserveWhiteSpace = false;


    } /* if is home end */
    return $content;
}
add_filter( 'the_content', 'mb_find_my_image' );
?>

However, it seems that I always get the following error:

Read More

Empty string supplied as input on line 6

What I’m I doing wrong here?

Related posts

Leave a Reply

1 comment

  1. I have fixed the problem.

    The main problem was that I was calling the function mb_find_my_image from index.php. After I’ve removed the calling from index.php, everything works as it should.