query_posts taking a while to load

I've created a simple WordPress website, however, it is taking a while to load. I am filtering out all posts, and only showing those with a tag of front:

<?php 
query_posts( 'tag=front' );
while ( have_posts() ) : the_post(); 
    ?>

I understand this might be a bad practice. If so, why, and is there a simple alternative?

Solutions

try this:

<?php
    $paged = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;

    $args = array(
        'tag' => 'front',
    );

    $front_query = new WP_Query( $args );

    global $more;
    if ( $front_query->have_posts() ) :

        while ( $front_query->have_posts() ) : $front_query->the_post();
            $more = 0;
    ?>
                <h1><?php the_title(); ?></h1>
                ....
                ....
                ...
    <?php   
        endwhile;

    else :
        get_search_form();
    endif;
?>

Similar questions

how load wordpress in a subdirectory without wordpress in root directory taking over
I have my production Wordpress website at example.com.au running from /public_html I also have a standalone Wordpress site in a /public_html/mainwp subdirectory running Main WP. The .htaccess in /public_html is: If I try to load example.com.au/mainwp/wp-admin, I receive a 404 served by Wordpress at example.com.au If I rename /public_html/.htaccess ...
custom page taking long to load on wordpress It only show post for today (or latest post)
This custom Page is taking at least 40 seconds to load. The other pages are loading in under 3 seconds. I want to show the post only for today on the front page like a today's news. What's wrong with the code?
Page Speed Taking time to load due to php looping and exporting data
I have an interactive map application I am building and the database is relatively small at about 11mb. However it has a lot of rows of data the require me to go through sort them into counties and years. My page load speeds are about 10-11 seconds trying to go through all of this data and get it organized so that I can then load it with a javascri...
Why is my website taking forever to load?
https://nl.ipgmediabrands.com/ First thing you see on the frontpage. I am very sorry I can't be more specific. I do think it has something to do with my .htaccess file. Although WordPress says I fixed that problem, the website still won't load properly.
wordpress website AWS taking too long to load
I have a website running on wordpress (Bitnami).the server is on an AWS behind an elastic load balancer. However, when i hit the wordpress website, it is taking too long to respond. There is another nodejs API that is running on the same AWS server (on port 4000). That is returning a response pretty fast. So, this would not be a DNS resoulution iss...
Website taking too much time to load on browser
my website is running slow https://www.creekharbour.co/ too much server response time. FPC is also very high I have installed the LiteSpeed cache plugin. it decreases the load time but my contact form 7 stopped working. then I have to deactivate that plugin. Can anybody tell me an easy solution as I am not a developer :(

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.