Accessing and running query in another template file

I’m trying to access the current query ( Front page and Archive ) and use it in some other template file. I just used the query twice the following way:

if (have_posts()) :
    while (have_posts()) : the_post();
        // Do some stuff
    endwhile;
endif;

But i’ve noticed this drastically reduces the site’s speed (at least 2 seconds).

Am i doing something wrong? Why using this query the first time has little to no impact on loading speed, but using it a second time does this?

This is the main query, so i’m not using any instance of WP_Query.

Read more here: Accessing and running query in another template file

Leave a Reply

Your email address will not be published. Required fields are marked *