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

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


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: