Home Forums ACF PRO Performance issues with hundreds of queries Reply To: Performance issues with hundreds of queries

  • Ok that makes sense. I tried to use get_post_meta() at the beginning of my single.php but had some difficulties with deserializing my gallery-field… But isn‘t this field only queried once?
    When I use the get_post_meta here would have to loop each attachment-ID with wp_get_attachment_image_src to get the sources for each image, which would go along with additional queries and would not improve the performance, right?

    <?php $post_data = get_post_meta($post->ID); 
    $galerie_neu = $post_data['galerie_neu'][0]; 
    if ($galerie_neu) {
    ($galerie_neu) { 
    $galerie_neu = unserialize($galerie_neu);
    foreach ($galerie as $galerie_item) {
    $galerie_id = $galerie_item['bild'];
    $thumb = "galerie";
    $full = "large";
    $image = wp_get_attachment_image_src( $galerie_id, $thumb );
    $fancybox = wp_get_attachment_image_src( $galerie_id, $full );

    I guess the main amount of queries is generated through my option-fields (about 400 out of 600). I checked my database and found about 100 unused old fields which are not listed in the backend anymore – would deleting them enhance the performance?
    Caching the option-fields would – in my optionion – solve my performance problem as every single page makes up to 100% use of all these fields. So I would have to manually change all option-field-entries in the DB to autoload = yes? Would that be a conclift issue with the JSON-feature?

    I will mark your post as the solution – because it helps in generally but in my eyes does not help in my special case.

    Thanks again for your help!