WP_Tax_Query Generator

Overview

Use this tool to create custom code for WordPress Tax Query with WP_Tax_Query class.

Usage

  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.

Examples

If you are still learning how to use this tool, check out the following examples:

The variable used in the code.
The MySQL keyword used to join the clauses of the query.
Taxonomy being queried (e.g. category, post_format, movie).
MySQL operator used with terms in the WHERE clause
Select from your saved Tax Query snippets.
Term or terms to filter by. Single string or comma seperated.
Whether to include child terms, or not.
Field to match terms against.
Taxonomy being queried (e.g. category, post_format, movie).
MySQL operator used with terms in the WHERE clause
Select from your saved Tax Query snippets.
Term or terms to filter by. Single string or comma seperated.
Whether to include child terms, or not.
Field to match terms against.
Taxonomy being queried (e.g. category, post_format, movie).
MySQL operator used with terms in the WHERE clause
Select from your saved Tax Query snippets.
Term or terms to filter by. Single string or comma seperated.
Whether to include child terms, or not.
Field to match terms against.
Taxonomy being queried (e.g. category, post_format, movie).
MySQL operator used with terms in the WHERE clause
Select from your saved Tax Query snippets.
Term or terms to filter by. Single string or comma seperated.
Whether to include child terms, or not.
Field to match terms against.
Taxonomy being queried (e.g. category, post_format, movie).
MySQL operator used with terms in the WHERE clause
Select from your saved Tax Query snippets.
Term or terms to filter by. Single string or comma seperated.
Whether to include child terms, or not.
Field to match terms against.
  Save Snippet
$tax_query = array(
	array(
		'taxonomy'         => 'event_type',
		'terms'            => '100-holes',
		'field'            => 'term_id',
	),
);