Jump to content

  • Free consultations and support
  • Live chatClick Here for Live Chat
  • Call ico 1888-906-1888
    Phone support: Open

    Ready for your call :)

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams

    Phone support: Closed

    We are back in: 1h 20m

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams


WordPress query_posts() alternatives

query_posts alternatives wordpress

  • Please log in to reply
 

#1 SmartWeb

SmartWeb

    Senior Member

  • Designer
  • 271 posts

Posted 18 June 2013 - 04:07 PM

It is not advised to use Query_post() since it will run a lot of background operations relying on the WP_Query, and WordPress will load your main query before the template files in your index.php file. Use the following instead:
When you need to have multiple loops in a page, use WP_Query object.
To modify your main look, use the pre_get_posts filter
If you need to modify the main WP loop use the pre_get_posts filter
If you don’t need a loop and just want to get a post





Also tagged with one or more of these keywords: query_posts alternatives, wordpress

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users