It isn’t has_posts
, it is have_posts
. You’ve just got the method name wrong. That’s all.
Related Posts:
- WP_Query vs get_posts
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- WP_Query: query posts by ids from array?
- pre_get_posts with get_posts
- Query Custom Meta Value with Increment
- Identify which loop you are hooking into; primary or secondary?
- Transient pagination not working properly
- meta_query on a date range using an array of values
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- if/else on custom query gives 200 OK when condition not met?
- Order by empty custom field
- Check if loop has any categories?
- How to get list of posts from permalinks?
- Is_single() conditional tag returns null in query
- Transient api Caches confused
- Include current post into loop
- Should I reset $wp_query?
- How to filter query loop block with a search string from the query parameters
- I am officially missing something about transient posts
- WP_Query & Duplicate entries
- how to show more than 1 post into three columns query
- Ordering Posts by parent category, name ascending
- WP_Query secondary query failing
- Loop through multiple custom fields with increasing number
- meta_query dates from an array
- Main loop querying current template’s info only in custom category archive pages, not my posts
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- Wp get all the sub pages of the parent using wp query
- Show posts without term
- How to use a custom post type as front page?
- get_template_part in for loop
- “pre_get_posts” firing on every query
- Add the “active” class only to the first loop item in a WordPress query [closed]
- Get posts by meta data OR title
- WP_Query ordered by custom field that is a date string?
- Loop inside the loop
- How to count post type that has a particular term?
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- cloning a WP_Query
- WP_Query Performance Issues with meta_query
- How is WP_Query connected to WP_Post in The Loop?
- Query Set Order By Author
- Empty tax_query array returns an empty array
- How do I search inside specific taxonomies in WordPress
- How to limit WP_Query to one result on the loop?
- How to correctly pass values to wpdb->prepare()?
- Random loop with code to prevent duplicate output returns no output at all from time to time
- Setting get_queried_object
- remove query arg from url after set query
- How to use offset in WP_Query
- difference between like ‘%%%var%%’ and ‘%var%’
- Multiple loops without repeating content
- Sort query by author: 1 author, then others
- Overwrite YoastSEO meta-tags with another page’s [closed]
- Filtering posts from different categories into different section by doing WP_Query only once
- How to duplicate 5 posts out of WP_Query results?
- WP_query sorting can’t sort danish letters (æ, ø, å)
- Slow queries on a huge database
- Multisite pagination issue by multi query archive 404
- Query with relation and one without relation using multiple taxonomies?
- Custom taxonomy.php not working
- different for loop if screen resolution < 1000px
- How can I override one post and make it display content for another post?
- Get multiple users with meta value in one query and populate WP_User class
- sort and display posts by custom field (wp-query and the loop))
- inserting content of 1 Post to in another with a template hierarchy
- Pagination for custom loop on custom page template is not displaying anything
- Filtering by multiple conditions in the loop
- How to access $wp_query object from array of posts given by get_posts?
- Display all attached image of every post of custom post type and link to original post
- Writing less unnecessary code with WordPress
- WordPress Queries Not Working?
- Filter subpages in while loop from WP Query object
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Custom query does not find pages
- How to sort by most watched in X days/months
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Post incorrectly excluded when using “category__in”?
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- How can I use arrays and a foreach to generate many lists with WP_Query?
- display ACF repater field in archive page
- WP_Query breaking the loop in a nested loop
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Related posts queries
- Query against multiple locations within single custom post type post
- WP Query. Ordering posts by another post types meta
- How to make a search query if not found in post table then search in postmeta table?
- update_post_meta() not updating
- why default wordpress loop not working outside index.php
- active link for most recent post on vertical tabs
- custom query – offset to pagination
- Pagination in custom query in a category page
- Get a list of the last posts grouped by author and filtered by category
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to query post ids liked by the Author
- How ‘secure’ are loops?
- Pagination in WP query with transient API
- How to do a loop inside a loop?
- How can I display sticky posts at first in wp_query?