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
- meta_query: check if number exists
- Using custom taxonomies in a query
- get_posts output always same post
- Query Posts by Tag and exclude
- Use WP_Query or query_posts() or get_posts() for optimizing a site?
- get_posts always returning the same number of posts = 5
- “paged” in WP_Query returns 0 posts
- Specify strict ‘order by’ in WordPress query
- get_posts() and global variables
- complex get_posts() query to select child pages
- How to add custom meta to ‘pre_get_terms’?
- Tax Query only returns for the first of several terms
- Can’t fetch Custom Post Type Data through Custom Query
- Get posts that do not have the same tags as current
- How I can change the condition or compare operator for WP_Query in pre_get_posts
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- exclude product with available tag
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Check if searched number is within the post meta value
- One WP_Query that always shows 1 post from category X and 1 post from “not in category X”?
- How to print term name inside wp post loop
- get_posts custom field
- Using get_posts to get posts based on a checkbox value with Advanced Custom Fields
- How to apply a function to a metadata value before launch a WP Query?
- Posts query according to meta box date
- Woocommerce: order posts by meta key
- 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?
- Display posts by tag
- Creating attachments archive in tags and categories
- Query Taxonomy By Page Title
- How to access $wp_query object from array of posts given by get_posts?
- Function using get_posts() with tax_query not working when called from functions.php
- Custom Taxonomy Breaks Pages
- Get posts by category name
- Get posts with no tags?
- get_posts query matches too many results
- Search for pages with permalink
- How to query for a page, get data, then query for child pages of that page
- Execute PHP function inside the admin area
- Why always one post missing
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- How to add date_query to meta_query array
- Why my query is not “Main_query”?
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Why is my pagination /page/2 taking me to index.php?
- Filter products on category AND tag
- Show X taxonomies of the latest published posts
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- Facing problem with tax_query results
- get_posts query is taking about 40 seconds to execute
- Only show tag with the same id as the post
- display ACF repater field in archive page
- Populate select list with meta values from all posts of a Custom Post Type
- Filter for each loop when WP_Query has no posts to show
- Form checkbox value going to dynamic URL
- Custom Taxonomy – Modify Function to Get Child Category
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- How do I stop the same post showing multiple times in a archive?
- Get posts that match defined arrays of tags
- get_posts return only first result
- Related posts queries
- Related categories order posts by category
- WordPress – Form does not filter the results of taxonomies
- How to get meta key list efficiently?
- WP Query for all events prior to current date
- How to get taxonomy image attached to a Post Type WordPress
- list all post who have mutual taxonomy as current taxonomy!
- Order posts by tags count?
- Fix wp_term_relationships slow query in get_posts
- how to get wp_query posts only first letter of alphabet A?
- Show one post of each custom taxonomy
- Query WP Posts, then list the taxonomies from those posts
- Query a custom taxonomy in a function to create an csv file
- getting posts by tags
- Search with WP_Query, but ignore href URLs in anchor tags?
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- Displaying posts from sub taxonomies only
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- Show posts from categories instead of tags
- Optimal way to make tags in tax_query optional?
- get_posts query caching?
- How to define a custom hierarchy for terms?
- Get posts with any value in attribute
- My entry results are not consistently alphabetized
- post_type not working when tag__in is present?
- Related Post by Tags Code
- Taxonomy Terms That Don’t Exist Display Results