• Hey everyone,

    I’m querying various posts and pages on my home page. For example one with a special tag, one with a special page_id, the last post of a special category etc.

    For all queries I’m using the following syntax:

    <?php
                $args = array(
    			'cat' => '28',
    			'posts_per_page' => '1',
    			);
                $my_query_1 = new WP_Query($args);
    
                if($my_query_1->have_posts()) :
                while($my_query_1->have_posts()) :
                $my_query_1->the_post();
    ?>
    
    <div><?php post_class(); ?>content_1</div>
    
    <?php endwhile; wp_reset_postdata(); else: ?><?php endif;?>
    
    <?php
    	    $args = array('page_id' => '4143');
    	    $my_query_2 = new WP_Query($args);
    
    	    if($my_query_2->have_posts()) :
    	    while($my_query_2->have_posts()) :
    	    $my_query_2->the_post();
    ?>
    
    <div><?php post_class();?>content_1</div>
    
    <?php endwhile; wp_reset_postdata(); else: ?><?php endif;?>

    etc.

    Having all those queries on my homepage the website is quite slowly. Is there a better way to solve this?

    Would be nice to get some help from you!!
    Thanks, cara

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Multiple WP_Query – Performance Problems’ is closed to new replies.