Does your custom post type have the setting publicly_queryable=true?
Check the post type in the resulting query to see if it matches your post type. I’m guessing that your post type ‘distribution_centre’ is not being queried for one reason or another.
add_filter( 'posts_request', 'dump_request' );//show the query
function dump_request( $query ) {
echo "<pre>";
var_dump( $query );
echo "</pre>";
return $query;
}
Related Posts:
- Get all posts without tags
- WP_Query, tax_query and term_meta: How to?
- Query post from all category with same tag on 1 pages
- How to get posts by category and by choosing a taxonomy term?
- How to create page that lists tags by initial letter?
- tax_query not working properly with get_posts
- When to use WP_query(), query_posts() and pre_get_posts
- meta_query: using BETWEEN with floats and/or casting to DECIMAL
- How to add taxonomy filter on the query fly?
- Get Recent Posts by Date in Multisite
- Better way to get tag stats?
- Given a WP_Query, how can I get a list of tags?
- Executing Queries in tag.php
- Query all posts where meta value is empty
- Query two taxonomies via URL or link?
- post_type is ignored by WP_Query when ‘tag’ argument is included
- Get_post() with meta_key when compare is a date
- get_posts not finding argument: post_name
- Function to check if author has posted within the last x days
- Select posts wich has no relationship in custom taxonomy
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- get_posts() seemingly ignoring post_type
- Can not switch the queried post in pre_get_posts hook
- Filter and list posts of a custom taxonomy
- Count posts returned by get_posts in external PHP script
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- SELECT * FROM $wpdb->posts WHERE ID > 160
- Pagination problem after WP_Query with tag filtering
- Display link to taxonomy archive only if it has posts with certain custom field values
- Adding multiple post queries with parent and children to page – Best Way
- Create a sitemap without a plugin – get parent pages only?
- Creating a custom search for a specific post type
- get_posts – find out if querystring was crap and fallback is used
- Creating query to show which editor (classic or block) was last used to edit a post/page
- Function get_queried_object() return NULL in custom taxonomy
- Include tags in WP_Query
- Search for multiple tags?
- WP_Query() and get_posts() can’t handle over a thousand posts?
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Weird orderby => post__in issue
- Query posts intersecting tags and categories
- WP_Query ignoring tax_query when is_singular
- Search form not working with custom query?
- Post loop for all taxonomy terms
- Conflict with get_posts and the_content
- How to show more post at a given category?
- Get posts by list of post IDs ordered by those IDs?
- Reset WordPress Post Query to default
- Filter Custom Taxonomy Posts
- Using custom taxonomies in a query
- Use WP_Query or query_posts() or get_posts() for optimizing a site?
- Specify strict ‘order by’ in WordPress query
- get_posts() and global variables
- WP_Query to output chosen term and posts with no term assigned
- exclude product with available tag
- Using get_posts to get posts based on a checkbox value with Advanced Custom Fields
- WP_User_Query and user posts
- Check if a post has term inside loop
- WP_Query by keyword OR post tag
- How to restrict search on a certain page to only return results against custom taxonomies?
- Query Taxonomy By Page Title
- Execute PHP function inside the admin area
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- Why my query is not “Main_query”?
- Facing problem with tax_query results
- Populate select list with meta values from all posts of a Custom Post Type
- Form checkbox value going to dynamic URL
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- Get posts that match defined arrays of tags
- get_posts return only first result
- WordPress – Form does not filter the results of taxonomies
- How to get taxonomy image attached to a Post Type WordPress
- Order posts by tags count?
- Show one post of each custom taxonomy
- Show posts from categories instead of tags
- get_posts query caching?
- How to define a custom hierarchy for terms?
- Adding additional taxonomies to wordpress taxonomy page
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Query Top Set Custom Taxonomy In Given Timeperiod
- Rewrite rule pagination on different url levels
- Select posts wich has no relationship in custom taxonomy
- How to get hierarchical number of custom taxanomy
- Get newest value of an array
- Filter custom post type by custom taxomony
- Both WP_Query and get_posts returning 1 post
- Get Posts by tag from a custom taxonomy
- Limit Tags display and ad Drop Down Menu
- query_posts problem – need help
- Weird query with get_posts and WP_Query
- WP_Query and DES sort for Custom Taxonomy based upon a meta field?
- orderby and order filter in get_posts or WP_query function in wordpress not working
- Query custom post types by meta field in a term from custom taxonomy
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Empty query on Custom Post Type, using WP_Query or get_posts
- A Depth Like Parameter For “get_posts”
- Give attachments an archive page, and exclude unattached ones
- I’m trying to get posts under a custom taxonomy but I don’t know what I’m doing wrong here
- Display Featured image from custom post type category (custom taxonomy) wise