GenerateWP

Overview

Use this tool to create custom code for WordPress Term Query with WP_Term_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.

Query Variable Name The variable used in the code.

Show The Loop Show the term loop.

Taxonomy A single taxonomy name, or a comma separated list of taxonomies.

Term Name Return term by name. Use comma separated list to return an array of term names.

Term Slug Return term by slug. Use comma separated list to return an array of term slugs.

Search Return terms by general search criteria.

Term Name Like Return terms with names like the criteria.

Term Description Like Return terms with description like the criteria.

Include Return specific list with the included term IDs. Use comma separated list to return an array of terms.

Exclude Return specific list without the excluded term IDs. Use comma separated list to return an array of terms.

Exclude Tree Return specific list without the excluded term IDs along with all of their descendant terms. Use comma separated list to return an array of terms.

Child of Term ID to retrieve child terms of. If multiple taxonomies are passed, $child_of is ignored.

Parent Parent term ID to retrieve direct-child terms of.

Hierarchical Whether to include terms that have non-empty descendants.

Childless True to limit results to terms that have no children. This parameter has no effect on non-hierarchical taxonomies.

Order Ascending or Descending order.

Order by Sort retrieved terms by.

Custom Field Key Return terms matching a specific metadata key.

Custom Field Value Return terms matching a specific metadata value.

Count Whether to return the total count or array of term objects.

Pad Counts Whether to pad the quantity of a term's children in the quantity of each term's "count" object variable.

Return Fields Set the fields you want to return.

Hide Empty Whether to hide terms not assigned to any posts.

Get Whether to return terms regardless of ancestry or whether the terms are empty.

Cache Domain Produce this unique cache key when this query is stored in an object cache.

Cache Term Meta Returm terms with/without caching the meta information.

Read the original on generatewp.com ↗