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?
$dom->loadHTML($content);?var_dump($content);tell you? Add that as the first line inside the function.var_dumpoutput I have seen. I expectedstring(123)"content content content". Thatnullis especially interesting and do you actually have those<html code>tags or is that some kind of filler you made up? Either way, it looks like the string is not empty.