I’ve found the solution. The problem was I had a different number set for the posts_per_page
parameter in the initial query and in the custom query I make via AJAX. In the code I provided posts_per_page
is not even there because I’m using a few nested classes, so I’ve posted a stripped-down version of the code for simplicity. I was sure the issues was with custom post types, never thought using different posts_per_page
could cause a problem. Apologies about that.
So yeah, if you’re running into the same problem make sure that your posts_per_page
is the same for all your queries!
Related Posts:
- AJAX search on post pages by custom post type
- get_query_var() not working in pre_get_posts
- WP_Query ignores post_type in category view
- Filtering a WP_Query meta_query by numeric values isn’t working
- “pagination” (but not really) and queries using custom posts types
- Pre_get_posts Gives 404 on Custom Post Type
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- Query for posts from any post type but only add instock products
- Query not returning CPT posts
- Custom Taxonomy and tax_query Issue?
- Unable to display multiple post types in same query (WPML WP_Query)
- WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts
- Query to get the author who having maximum number of post (custom post type)
- How to use custom post type APIs, but use a different db table
- Display all Posts and only certain Custom Post Types with meta fields
- Select menu should display categories and the item’s depth
- Custom Post Order for a Custom Post Type
- Show Post Count of a Category
- Lists Posts from CPT that match the Title of the Page
- Filtering by Post Meta Custom Fields – Performance
- Remove duplicated values from a loop
- Fetch taxonomies by custom post type id array
- is there a way to retrieve posts that do not have a featured image assigned?
- How to connect two custom post types with nested loops
- Custom Post type and Custom Field WP_Query
- Display multiple custom post types and sort them chronological by one of their fields
- Using DISTINCT in wp_query
- Related posts in all categories of current post (custom post types)
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- How to show CPTs in term archive
- shortcode to show custom post types by category
- Query/list all terms and their custom post count
- Genesis filterable portfolio isotope [closed]
- Get custom taxonomies from multiple posts
- Pagination on with query_posts in custom post type template
- Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”
- Custom post ui plugin & WP_Query – Polylang
- How to use load more custom post type data normal or according to on click category tab In WP
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Polylang non-default language ignores tags in WP_Query
- Problem: wp_query outputs all images on site
- wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Custom WP_Query doesn’t display all posts
- WP_Query() with custom post type and taxonomy — get all terms?
- Query & the_content() is showing in the header
- Variable not working in WP_Query
- Wp Query with multiple custom tag(taxonomy) by get the terms
- Pagination not working on custom query on a page
- Query within a foreach within a query (queryception)
- How to get Custom Post Type with Categories wise in WordPress using wp_query
- WP_Query of a custom post type isn’t working
- Query custom posts from custom taxonomy
- Query Custom Post Type by Taxonomy
- Related “custom post type” using “custom taxonomy”
- Page that lists publications by classifying them by taxonomy
- Exclude a specific post in a Custom Post Type
- Random item on Custom Query working Local but not on live
- Filtering posts based on three taxonomies
- wp_post_delete is deleting all offices
- How can I get custom post types to recognize pretty permalink variables?
- Error in the page of a CPT file in WordPress
- How to display grandchildren only of custom post?
- Sort custom post archives by a meta value from a different custom post type?
- WP_Query based on ‘s’ and tax_queries
- post type => ‘any’ not applied my custom queries
- One of my headings is mysteriously coming up as a link in my CPT Archive
- Query the title of the page to show posts with matching category in the loop
- The most recent post of custom taxonomy
- Display child posts from a certain category
- Problems with the WP_Query query for a Custom post type
- wp_query return nothing
- Main site single-property.php design, as homepage of a multisite
- Insert single CPT items every x posts of another CPT
- Custom post order when using OR relation
- Editing custom post type
- Get archive of posts separated by taxonomies and subtaxonomies
- Can’t seem to filter wp_query by current category ID
- why custom post archive gives always no more than 10 posts despite of paging settings?
- WP_Query with custom post type search showing all results every time
- Post data in separate divs with incrementing class using WP_Query
- Selecting posts older than the current Unix epoch timestamp
- WP Query WordPress Post Type with the same Taxonomy name
- How to list groupings and keep pagination
- How to retrieve taxonomy terms of the current custom post?
- Change display wp post type to wp custom post type
- Query recent posts by author
- Dynamically change post_parent in every page load?
- direct custom post query interferes with other queries on page
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- WP_query orderby not working after WP4.0 update [closed]
- How do I correctly query posts from a post ID?
- display custom post type from register taxonomy
- Wp-theme Development
- Create a WordPress Database query to find users who purchased specific product through WooCommerce [closed]
- Store custom post type with JSON content
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- How do I get parameters from the URL?