query_posts()
is useful in cases when there is no main query: calls to wp-admin/admin-ajax.php
, wp-admin/admin-post.php
or wp-login.php
for example.
Yes, you can achieve the same results there without query_posts()
and slightly less compact code instead. But if you don’t have to care about side effects, using query_posts()
is acceptable.
Related Posts:
- Is `query_posts` really slower than secondary query?
- How to Loop within a Loop (Display Children and then Grandchildren)
- 3 Posts in Loop, Show Stickies First
- Query last updated posts (posts updated in the last 24 hours)
- How to display posts by vote count and if no value continue with latest posts with no votes?
- Query posts only with actual text content (not including shortcode or images)
- How to fix pagination for custom loops?
- WP_Query vs get_posts
- Remove the Homepage Query
- Query Custom Meta Value with Increment
- Why is it necessary to call rewind_posts() when using the loop more than once? [duplicate]
- Multiple posts with one loop iteration
- Transient not working for custom loops
- Post Loop not Returning Permalink
- post loop causes wp_users and wp_usermeta DB queries for each users
- get_the_foo() in the loop – does it perform another query?
- If No Search Results, Show Posts from Alternate Search Query
- Exclude first 2 posts with meta_key from loop
- Loop posts only excluding first post
- Better way to display posts from specific categories, in a grid layout
- Loop after page content
- query_posts() ALWAYS displays something?
- A loop with all articles with certain text strings in tags
- popular post weekly and monthly
- Display most viewed post from last 30 days is not working correctly
- Query posts if meta key starts with
- How to go about combining dropdowns / filter queries?
- Query reset problem or flawed code to enable custom post type query
- Displaying terms based on loop posts?
- Conditional query that displays on Woo product attribute pages
- Duplicated posts on category page
- How do I use AJAX Query in my posts loop?
- woocommerce get_price_html not pulling in correct price
- Make blog page show 10 on first page, 9 on every other page
- How to fix pagination for custom loops?
- How can I paginate this?
- How to fix pagination for custom loops?
- query_posts() vs get_posts() multiple loops [duplicate]
- Split wordpress loop to multiple layouts
- Making a query to the DB using same parameters of loop
- Exclude first post (sticky or not) from the loop using query_posts()
- How to order by multiple fields using standard query_posts?
- Pagination not working in category listing [duplicate]
- How can I improve the performance of this query_posts loop?
- Include current post into loop
- Loop inside query
- Adding div after every two post on main loop! Why will first post not get counted?
- How can I access specific posts brought back by query_posts?
- Should I reset $wp_query?
- Separate First Post Loop
- get_delete_post_link() inside Loop stubbornly returns nothing
- loop inside the foreach
- query_posts clarification needed
- Custom Post type showing up in loop, regular posts are not showing up
- Exclude posts based on an array
- Query post & loop problem.
- Exclude current post ID from loop in sidepbar.php
- Loops for cat links not looping for wordpress site
- How do I set the Stewart Search Template to return only published posts in the result
- Why does my WP_Query pagination on a custom page.php only loads the homepage?
- Get a Post Loop based on Logged in User information into a Shortcode
- Trying to get all links in my posts
- Custom Query with Sticky Posts
- how to add 4 post in one carousel slide
- Build a Page which shows the Oldest Post with specific Custom Field Value
- Query posts and display all dates in repeater field in chronological order
- How to fix pagination for custom loops?
- Get featured image outside the loop using foreach
- Alternative layout the loop
- Ordering Posts by parent category, name ascending
- Show posts by tags excluding current post
- Strange problem with wp_get_attachment_image_src database (db) query count
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Next 10 posts data of currently viewing post in blog page
- How to fix pagination for custom loops?
- Query counting excluded category on paged loop
- get_posts and wp_autop (remove filter)
- How to fix pagination for custom loops?
- How to fix pagination for custom loops?
- query_posts ignores the argument
- The Loop isn’t working
- Get query result before posts are displayed?
- Twitter bootstrap carousel multiple items in carousel
- Combine Query and Select Database to create directory loop
- show posts from one category with comments only
- Least Number of Loops to Create Custom Homepage?
- WordPress loop: Display if posts exist
- wordpress showing all posts instead of date range
- How to do query_posts on tags pages
- Limitless amount of posts in custom archive page
- Multiple loop with pagination in same page
- Query Loop Block: possible to restrict just child pages?
- Use Base-URL with Query-Loop
- Loop through all media library images and return those where caption contains the text carousel
- Displaying the last page of posts
- Sanitize Custom Field Value in Meta Query
- need help looping add_action in wp
- Custom Post Type Query W/Category Dropdown
- Check value of post meta within IF statement
- How to exclude certain portfolios from a loop