Support

Account

Home Forums General Issues the_content() seems to block my ACF-code

Solved

the_content() seems to block my ACF-code

  • If I use my ACF-code alone it works fine, but as soon as I include the_content, the page only displays the main content, and nothing from ACF. Here’s my code, very simplified (yet it still exhibits the behaviour I describe):

    <?php while ( have_posts() ) : the_post(); ?>
    
        <?php the_content(); ?>
    
        <?php
        if( have_rows('boxes') ): ?>
            <p>This is only shown when the_content() is removed.</p>
        <?php
        else :
            // no rows found
        endif; ?>
    
    <?php endwhile; ?>
  • I found out what it was. Actually I think this might be caused by a bug in WordPress (or perhaps one of the add-ons I’m using).

    In the content editor I had blocked out some of the code with “<!–” and “–>”. For some reasonthe closing markup “–>” didn’t get registered, so in the code anything after the_content(); got blocked out.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘the_content() seems to block my ACF-code’ is closed to new replies.