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:
Empty string supplied as input on line 6
What I’m I doing wrong here?
I have fixed the problem.
The main problem was that I was calling the function
mb_find_my_image
fromindex.php
. After I’ve removed the calling fromindex.php
, everything works as it should.