• I’m making a plugin to parse my post content with PHP, and I have this line of 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, I’m always getting a “Empty string supplied as input” error.
    I’m guessing that $content variable is the problem, but I don’t know what’s wrong.

    I’m testing this using WAMP on my local computer.

    [bump moderated]

The topic ‘$content is an empty string?’ is closed to new replies.