[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
Taxonomy API: WP_Term_Query class.
File Size: | 1133 lines (40 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_Term_Query:: (10 methods):
__construct()
parse_query()
query()
get_terms()
parse_orderby()
format_terms()
parse_orderby_meta()
parse_order()
get_search_sql()
populate_terms()
Class: WP_Term_Query - X-Ref
Class used for querying terms.__construct( $query = '' ) X-Ref |
Constructor. Sets up the term query, based on the query vars passed. param: string|array $query { since: 4.6.0 since: 4.6.0 Introduced 'term_taxonomy_id' parameter. since: 4.7.0 Introduced 'object_ids' parameter. since: 4.9.0 Added 'slug__in' support for 'orderby'. since: 5.1.0 Introduced the 'meta_compare_key' parameter. since: 5.3.0 Introduced the 'meta_type_key' parameter. |
parse_query( $query = '' ) X-Ref |
Parse arguments passed to the term query with default query parameters. param: string|array $query WP_Term_Query arguments. See WP_Term_Query::__construct() since: 4.6.0 |
query( $query ) X-Ref |
Sets up the query and retrieves the results. The return type varies depending on the value passed to `$args['fields']`. See WP_Term_Query::get_terms() for details. param: string|array $query Array or URL query string of parameters. return: WP_Term[]|int[]|string[]|string Array of terms, or number of terms as numeric string since: 4.6.0 |
get_terms() X-Ref |
Retrieves the query results. The return type varies depending on the value passed to `$args['fields']`. The following will result in an array of `WP_Term` objects being returned: - 'all' - 'all_with_object_id' The following will result in a numeric string being returned: - 'count' The following will result in an array of text strings being returned: - 'id=>name' - 'id=>slug' - 'names' - 'slugs' The following will result in an array of numeric strings being returned: - 'id=>parent' The following will result in an array of integers being returned: - 'ids' - 'tt_ids' return: WP_Term[]|int[]|string[]|string Array of terms, or number of terms as numeric string since: 4.6.0 |
parse_orderby( $orderby_raw ) X-Ref |
Parse and sanitize 'orderby' keys passed to the term query. param: string $orderby_raw Alias for the field to order by. return: string|false Value to used in the ORDER clause. False otherwise. since: 4.6.0 |
format_terms( $term_objects, $_fields ) X-Ref |
Format response depending on field requested. param: WP_Term[] $term_objects Array of term objects. param: string $_fields Field to format. return: WP_Term[]|int[]|string[] Array of terms / strings / ints depending on field requested. since: 6.0.0 |
parse_orderby_meta( $orderby_raw ) X-Ref |
Generate the ORDER BY clause for an 'orderby' param that is potentially related to a meta query. param: string $orderby_raw Raw 'orderby' value passed to WP_Term_Query. return: string ORDER BY clause. since: 4.6.0 |
parse_order( $order ) X-Ref |
Parse an 'order' query variable and cast it to ASC or DESC as necessary. param: string $order The 'order' query variable. return: string The sanitized 'order' query variable. since: 4.6.0 |
get_search_sql( $search ) X-Ref |
Used internally to generate a SQL string related to the 'search' parameter. param: string $search Search string. return: string Search SQL. since: 4.6.0 |
populate_terms( $terms ) X-Ref |
Creates an array of term objects from an array of term IDs. Also discards invalid term objects. param: Object[]|int[] $terms List of objects or term ids. return: WP_Term[] Array of `WP_Term` objects. since: 4.9.8 |
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |