You use multiple taxonomies at once, so use'relation' => 'AND'
:
<?php
$args = array(
'posts_per_page' => -1,
'post_type' => 'products',
'post_status' => 'publish',
'tax_query' => array(
'relation' => 'AND', // this is what was missing
array(
'taxonomy' => 'subjects',
'field' => 'name',
'terms' => $shortcode_atts['subject'],
),
array(
'taxonomy' => 'plans',
'field' => 'name',
'terms' => $shortcode_atts['plan'],
),
),
);
Related Posts:
- Show ACF field from custom taxonomy and display on the single template
- Custom front-end form for adding post – Category problem
- Getting custom taxonomy from custom post type
- Get Custom Taxonomy ID within loop
- Get custom post type by category in a page template
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Categories under custom post types doesn’t show properly
- Meta Query “IN” doesn’t work with ACF checkbox filter
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Ajax filter with custom taxonomies
- List events by month
- Filter posts with ajax form and checkboxes
- get terms that have post with custom post type between 2 values
- How to get only one category of custom post type?
- Get all taxonomies for all post types
- Append taxonomy terms as class names in markup?
- Change message given when deleting post from custom post type
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Linking three taxonomies with ACF
- Get Custom Field Values by Another Custom Field in WordPress
- List terms from Custom Taxonomy
- WP_Query search posts by custom post type and custom taxonomy
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Link users to a custom post type
- How to output wordpress custom tags separated by comma?
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- Weird problem happening with custom taxonmy when creating/updating posts
- Create 3 Level Relations with ACF and WordPress
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- Received nothing after executing AJAX post function
- Retrieve value of a category’s custom field
- Get custom post type list for every category shortcode
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- 404 error when navigating to a taxonomy page with Cyrillic, what’s wrong?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Categorize custom post type
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Query Custom Post Type Taxonomy term with multiple parameters
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- How to update post meta on uploaded image from a custom form?
- How to group posts and get a mixed posts and groups view?
- Displaying custom field according to date
- Different Category system needed for the Custom Post Type
- Get term name without a foreach loop
- Trying to get custom post of a custom taxonomy
- Assigning categories to custom post types via a front-end form; only works for native post type
- WordPress – display relationship between blog posts and custom posts
- Custom sorting in post columns by ACF Pro Select Field
- Load info from customposttype into template page
- Display Custom Field or Custom Taxonomy in front page /post/product
- pagination problem listing custom post types of taxonomy in wordpress
- WP_Query not using custom taxonomy categories on custom post type
- If ACF Post Object post has custom taxonomy term…
- Some posts not displaying by taxonomy term
- Taxonomies are not showing in the category dropdown
- Combine multiple separate lists into one
- Taxonomy shows up twice on Custom Post Type
- How to display custom post type pagination buttons when processing AJAX request
- Filter Custom Post Type Posts by Taxonomy
- Change Search display for Custom Post Type
- Show parent category and subcategory once in while loop
- Custom search for a custom post type in WordPress
- Custom Taxonomy – fields
- Display custom tax in “while” loop
- tax_query not working?
- CPT: execute code after load if parameter is set
- Add active class to foundation 6 tabs while looping categories
- ACF Post Content Not Being Searched
- Display related post content and custom field content
- The most recent post of custom taxonomy
- Best way to have one product in both rental and sale parent category
- Show tags of custom post types in WordPress
- Group/list/sort custom post type posts by date in tabs from acf datepicker field
- WordPress query posts by custom post type not workng
- Show custom taxonomy not in submenu
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- Can’t pick up a field created with Advanced Custom Fields
- Pods pagination erases my sub menu
- Advanced Custom Fields: query posts filtered by multiple field values
- Custom Post-type not returning the right child_of
- Looping taxonomy in taxonomy?
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- posting twice from an array?
- Custom Loop for custom post type. Compare by meta_value?
- Inserting two categories
- ACF Relationship: Group posts by parent category term, then child [closed]
- Getting ACF relationship field information
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- How to I add count of custom posts listed in a post as a prefix to its title
- How do loop categories post from according in WordPress? is it impossible to solve this problem?
- Custom taxonomy meta fields
- Custom Sort Order for Custom Post Type Taxonomy
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding
- Custom fields disappearing when a custom post type is assigned
- How to Dynamically Filter Custom Post Types by Taxonomy Based on URL in Elementor Pro and ACF?