@jacob-peattie answered the question in his comment – I used the wrong key to set the number of posts my query generates. Swapping numberposts
with posts_per_page
solved the issue.
Here’s the final query:
@php
$cats = get_sub_field('reviews_category'); // gets the custom field categories
$args = array(
'post_type' => 'testimonials',
'posts_per_page' => -1, // this line updated
'order' => 'DESC',
'orderby' => 'meta_value',
'meta_key' => 'date',
'tax_query' => array(
array(
'taxonomy' => 'testimonial_categories',
'field' => 'term_id',
'terms' => $cats
),
)
);
$query = new WP_Query($args);
@endphp
Related Posts:
- Exclude a category from WP_Query
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Show Post Count of a Category
- Querying Term Posts in Loop
- wp_query check if integer exists in custom field’s array
- WP the_posts() on single-cars.php get category link
- WP_query – Filter by tax_query and meta_query using multiple select
- WP Query Conditionally query meta and taxonomy
- WP_Query not using relation key as expected and not producing any results
- Weird problem happening with custom taxonmy when creating/updating posts
- Group custom posts by custom taxonomy names
- How can i skip same post from taxonomy term?
- Filter by custom taxonomy slug on a custom post type
- Pagination on category page with custom post types
- Insert HTML inside link in a walker
- Custom Post Types and independent Categories – complex Taxonomy
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Should I use custom taxonomy or custom post type
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Set menu active state for custom posttype and category, given custom taxonomy term
- How to show CPTs in term archive
- Display CPT posts based on specific taxonomy
- Setting proper query for multiple custom admin filters
- shortcode to show custom post types by category
- WP_Query: include custom post type only with specific meta value
- Display all posts in main category and 1 subcategory
- showing custom post types of a certain category only
- Returning a list of custom post types excluding those without a specific meta_value
- Query/list all terms and their custom post count
- Linking to the most recent post in a Custom Post Type
- Custom Post Type Archive Page Filtering
- How can I auto-assign a CPT post to category in a custom taxonomy when published?
- Filtering WP_Query Dynamically on the Front-End
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Genesis filterable portfolio isotope [closed]
- Posts from all the categories are being displayed instead of particular category
- Wrong request query on cpt and tax
- Conditional Statement custom post type category
- Show custom post type filtered by category
- Custom Post Type With Categories
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Search / Filter posts on Title/Content OR Tags
- Categories sorting
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Allow user to set custom order to a list of custom taxonomies?
- get_category_parents for custom post type taxonomy
- Custom-Posttype & Custom Taxonomy WP_Query
- Custom loop with multiple taxonomy queries
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- forming WP_Query for posts of all post types but from specific categories
- wp_list_categories() – current-cat class also inside posts?
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Show a Category X’s custom post type on Category X archive page?
- How to filter wp_list_categories output with some custom post type meta query?
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Custom taxonomy rewrite give pagination 404
- Hide parent categories when clicked, and show it’s childs
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Limit amount of posts made within a custom taxonomy
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- How to do WP_Query with two meta fields with orderby clause
- Stuck in Order by more then one
- Can’t remove front from permalinks for custom taxonomy category page
- Custom WP Query on custom meta and sort by multiple meta keys value
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How can I made custom taxonomies relationship?
- What’s the WP way to load remaining custom posts?
- Why is this query not working? (Standard posts + custom post type)
- Custom taxonomies relationship
- WP Query with categories only shows one post and ignores the category
- How to edit this code to get the categories in achieve page?
- How to have this permalink structure: post_type/postname/custom_inner_page
- Query Custom Post Type Taxonomy term with multiple parameters
- Hierarchy and access control for Custom Post Types (CPT)
- Why is my category template ignoring post type?
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- First custom field value (out of several) displayed twice after query
- How to get custom posts sub category link
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- WP_Query orderby and tax_query
- browse by category and tags?
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Configuring a meta query with multiple post types that have the same relationship on a single page
- List of Posts and Categories
- Possible to filter custom post type with multiple meta data?
- Advanced search form with filters for custom taxonomies
- Query based on custom fields start and end date
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Custom Post Type Category Link
- Retrieve custom post types by custom taxonomies with WP_Query
- Custom Post type category pages template and loop
- tax_query not working in template
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()