Hi,
I’m using ACF Pro Version 6.0.5 with WP 6.1. I have a Flexible Content field with 6 layouts in it. They display fine on the front end. When I create a 7th layout in the field I just can’t get that layout to display. It’s like I’ve reached a limit.
If I try and just display that 7th layout and not display layouts 1-6 it displays.
Go figure. 2 of the layouts use basic Repeaters if it matters.
I did see 1 issue in my php-fpm-error.log “server reached max_children setting (4), consider raising it”
I’m hosted on Pantheon with these setting in php.ini
with max_execution_time = 120
max_input_time = 900
max_input_vars = 10000
memory_limit = 256M
Any help appreciated!
Thanks
My code is a series of if statements in a while loop. I’m not using any elseif
<?php if( have_rows('universal') ): ?>
<?php while( have_rows('universal') ): the_row(); ?>
<?php if( get_row_layout() == 'text' ): ?>
//output
<?php endif; ?>
<?php if( get_row_layout() == 'cards' ): ?>
//output
<?php endif; ?>
+ 6 more of these each querying a different layout
<?php endwhile; ?>
<?php endif; ?>
Found the issue. I was trying to call WP posts in a <?php elseif( get_row_layout() == 'featured_news' ): ?>
<?php
$tags = get_sub_field('tags');
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'tag' => $tags,
'posts_per_page' => 5,
);
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
...output
<?php
endwhile;
endif;
?>
but needed to have wp_reset_postdata();
at the bottom like:
<?php
$tags = get_sub_field('tags');
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'tag' => $tags,
'posts_per_page' => 5,
);
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
...output
<?php
endwhile;
wp_reset_postdata(); <=NEEDED THIS
endif;
?>
May help someone else