Support

Account

Home Forums Backend Issues (wp-admin) Slow update for large number of ACF Fields Reply To: Slow update for large number of ACF Fields

  • Hi @willryanuk
    I am also having this issue with a school website, listing teachers on a page.
    I currently have 75 teachers each with Name, Role, Picture, Email, Phone fields and each update can cause a timeout. It’s on a dedicated server so that’s why I think maybe some code optimization can help.
    This is the code I’m using, maybe you can find something not being optimised?

    
       <!-- /////////// Staff /////////////// -->                   
                         
                         <?php 
     
    				// check for rows (parent repeater)
    				if( get_field('staff') ): ?>
    					<div id="staff">
    					<?php 
     
    					// loop through rows (parent repeater)
    					while( has_sub_field('staff') ): ?>
    						<div class="section">
    							<h3><?php the_sub_field('title'); ?></h3>
    							<?php 
     
    							// check for rows (sub repeater)
    							if( get_sub_field('items') ): ?>
    								
    								<?php 
     
    								// loop through rows (sub repeater)
    								while( has_sub_field('items') ): 
     
    									// display each item as a list - with a class of completed ( if completed )
    									?>
    									
                                        <div class="item">
                              <div class="portrait">
                             
    <?php $image = wp_get_attachment_image_src( get_sub_field('image'), 'staff-portrait' ); ?>
    <?php if (get_sub_field('image')): ?>
    <img src="<?php echo $image[0];?>" alt="<?php echo get_the_title(get_sub_field('image'))?>" />
    <?php endif; ?>
    </div>
    <div class="data">
                         <h4 ><?php the_sub_field('name'); ?></h4>
                         <span><?php the_sub_field('role'); ?></span>
                         <?php if (get_sub_field('email')) : ?>
                           <span><a href="mailto:<?php the_sub_field('email'); ?>">שליחת מייל</a></span>
                           <?php endif;?>
                            <span><?php the_sub_field('phone'); ?></span>
    						 	</div>					
    						</div>       
    								<?php endwhile; ?>
    								
    							<?php endif; //if( get_sub_field('items') ): ?>
    						</div>	
     
    					<?php endwhile; // while( has_sub_field('staff') ): ?>
    					</div>
    				<?php endif; // if( get_field('staff') ): ?>
                         
                         
                         
                          <!-- /////////// End Staff /////////////// --> 
    

    Dan