Quickest : wp_query or get_posts ? (2 posts)

  1. Dunkkan
    Posted 6 years ago #

    Hi, I had a technical question, hope someone knows it :

    Between wp_query and get_posts, wich call to the database is quicker ?

  2. Dunkkan
    Posted 6 years ago #

    I'm retaking this tread :)

    I'm playing locally with a WP install, and in my theme I've had the occasion to compare the two.

    For me, get_posts is having a faster loading.

    Is it my template ?
    Here's a diagram of my index.php :

    ----------a list : get_posts(again, simply the 10 last posts) --------

    There, I realised I could not control, from the Admin Panel, how many posts I was calling in the Index, without editing the template. They were always 10, and some future user wouldn't like it, nor going to templating, so I went this way :

    ------------------------------a normal loop---------------------------

    Maybe it's the quantity of WP_query I'm calling, but it's a bit slower, and the images takes a bit more time than with get_posts.

    If anyone have some idea why / how to improve it / confirm it / comment it ... I'd like to optimize the template.

    Thanks for any input,

Topic Closed

This topic has been closed to new replies.

About this Topic