The main problem is that, in your $_POST loop, $value is an array, yet you apply htmlspecialchars to it, which will vomit and return back nothing.
If you haven’t done so already, set WP_DEBUG to true in your wp-config.php – developing without it is simply not an option.
Regardless, let’s fix that dirty $_POST loop:
$tax_query = array(); // Don't need relation "AND", it's the default
foreach ( get_object_taxonomies( 'recipe' ) as $tax ) {
if ( isset( $_POST[ $tax ] ) ) {
$tax_query[] = array(
'taxonomy' => $tax,
'terms' => wp_unslash( ( array ) $_POST[ $tax ] ),
'field' => 'slug',
);
}
}
$args['tax_query'] = $tax_query;
Related Posts:
- Why is my WP_Query not working when tax_query terms are an array?
- How to add terms to my tax_query based off of the current post
- Pass array of taxonomy terms to wp_query
- Formulate a url to show posts with both taxonomy terms
- Order by slug in get_terms with multiple taxonomies
- Function get_queried_object() return NULL in custom taxonomy
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Get authors by term id or slug
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Automatically Query Parent Taxonomy
- Taxonomy order exception for specific term
- Custom taxonomy.php not working
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- How to add custom meta to ‘pre_get_terms’?
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Can’t get term id for category archive
- How to make a post with certain taxonomy term display first before other post with only one query?
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Only show tag with the same id as the post
- Save queried result into database
- wp_query with meta_query and tax_query
- WordPress – Form does not filter the results of taxonomies
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- taxquery taxonomy get terms
- How to show terms from another taxonomy
- How to define a custom hierarchy for terms?
- Taxonomy Terms That Don’t Exist Display Results
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Include custom post type that matches taxonomy field in another custom post type
- Show posts without term
- WP query taxonomy input differs to output?
- Search custom taxonomy term by name
- Modify Term Update Redirection
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- Pagination not working for Custom search form & custom result template
- List taxonomy terms plus their latest post ordered by post date
- Using AJAX to return search form results
- Get random terms
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Filter and list posts of a custom taxonomy
- List all custom post type posts from a given category?
- WP_Query use for a filter with multiple Taxonomies and Terms
- Filtering posts by custom field value not working
- Display link to taxonomy archive only if it has posts with certain custom field values
- Get list of terms that have posts in another term
- Shortcode to show thumbnail and link for 3 random posts
- Changing stylesheet depending on custom taxonomy terms
- Output an array of terms for a ‘tax_query’ => array()
- WordPress Related Post by tags in Single.php
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- WP_Query Not Recognizing Taxonomy Parameter in Custom Search
- is_tax() function not working as expected
- Advanced Taxonomy Queries WordPress
- Custom post taxonomies as tax_query terms?
- Taxonomy Query Relation field not behaving correctly?
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How to order posts by title after they have already been sorted by category
- Combining categories (Query posts with multiple taxonomy terms)
- Taxonomy and Date in same query?
- How Can I Change The Tax Query For The Main Loop For Taxonomy Archives?
- WP_Query for a taxonomy with different taxonomy types
- get all posts associated with a custom taxonomy
- How to print term name inside wp post loop
- Get posts in taxonomy randomly
- Loop posts based on permalink term
- Using WP_Query for categories instead of get_terms
- Grabbing taxonomy terms and inserting them into an array
- Tax_Query using WP_Query not working
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Custom taxonomy in WP_Query not working
- Strange behaviour of hierarchical taxonomy archive
- WordPress Ajax form filter | Search by title with ajax form, breaks the other filters
- display ACF repater field in archive page
- How to use the Term Object from a custom select field in a query
- WP Query by 4 different taxonomies
- Display Custom Post Type Based on Taxonomy With WP_Query()
- WordPress custom search form – ignore empty/default input fields upon submission?
- Query a database based on form input then output to another page [closed]
- whether a nonce is required for get type and get_query_var?
- list all post who have mutual taxonomy as current taxonomy!
- pages shortcode filtering by category
- get term objects and post objects in query
- Combine Tax Archive and Meta_Query in WP_Query
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- Category Archive not working for pages
- How can I get all the posts that are related with a specific taxonomy term?
- Object of class WP_Query could not be converted to int inside shortcode
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Search format not matching taxonomy query
- List posts of terms but exclude one term
- Passing values by form to create a query
- Can One Taxonomies Terms be Ordered by A Seperate Taxonomy?
- Output ACF field dynamicaly within a taxonomy loop [closed]
- Incorrect taxonomy ID assigned to post with custom query
- Custom query for certain post type OR another post type with a certain category
- I need to get all categories from a WP_Query
- WP_Query on custom taxonomy -> Location and Activity
- Showing all posts of the current custom taxonomy on archive page
- Custom tag template to list posts in ASC order