I don’t understand why your “titles” are in the post body content, but you should not be echo
ing content from that filter. You should be creating and returning a string.
function auto_dummy_titles($content) {
if (strpos($content,'<h1>') === false) {
$content="<h1>PLEASE ADD H1 TITLE TO THE PAGE</h1>".$content;
}
return $content;
}
add_filter( 'the_content', 'auto_dummy_titles');
The function does work though. I can’t help but think that the problem is that you should be checking the actual post title for a title and not the post content.