[ Index ] |
WordPress Cross Reference |
[Source view] [Print] [Project Stats]
Taxonomy API
File Size: | 3469 lines (116 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_Tax_Query:: (47 methods):
__construct()
get_sql()
clean_query()
transform_query()
get_term()
get_term_by()
get_term_children()
get_term_field()
get_term_to_edit()
get_terms()
term_exists()
term_is_ancestor_of()
sanitize_term()
sanitize_term_field()
wp_count_terms()
wp_delete_object_term_relationships()
wp_delete_term()
wp_delete_category()
wp_get_object_terms()
wp_insert_term()
wp_set_object_terms()
wp_add_object_terms()
wp_remove_object_terms()
wp_unique_term_slug()
wp_update_term()
wp_defer_term_counting()
wp_update_term_count()
wp_update_term_count_now()
clean_object_term_cache()
clean_term_cache()
get_object_term_cache()
update_object_term_cache()
update_term_cache()
_get_term_hierarchy()
_get_term_children()
_pad_term_counts()
_update_post_term_count()
_update_generic_term_count()
get_term_link()
the_taxonomies()
get_the_taxonomies()
get_post_taxonomies()
is_object_in_term()
is_object_in_taxonomy()
get_ancestors()
wp_get_term_taxonomy_parent_id()
wp_check_term_hierarchy_for_loops()
Class: WP_Tax_Query - X-Ref
Container class for a multiple taxonomy query.__construct( $tax_query ) X-Ref |
Constructor. Parses a compact tax query and sets defaults. param: array $tax_query A compact tax query: |
get_sql( $primary_table, $primary_id_column ) X-Ref |
Generates SQL clauses to be appended to a main query. param: string $primary_table param: string $primary_id_column return: array |
clean_query( &$query ) X-Ref |
Validates a single query. param: array &$query The single query |
transform_query( &$query, $resulting_field ) X-Ref |
Transforms a single query, from one field to another. param: array &$query The single query param: string $resulting_field The resulting field |
get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') X-Ref |
Get all Term data from database by Term ID. The usage of the get_term function is to apply filters to a term object. It is possible to get a term object from the database before applying the filters. $term ID must be part of $taxonomy, to get from the database. Failure, might be able to be captured by the hooks. Failure would be the same value as $wpdb returns for the get_row method. There are two hooks, one is specifically for each term, named 'get_term', and the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the term object, and the taxonomy name as parameters. Both hooks are expected to return a Term object. 'get_term' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. Used in get_term() as a catch-all filter for every $term. 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. $taxonomy will be the taxonomy name, so for example, if 'category', it would be 'get_category' as the filter name. Useful for custom taxonomies or plugging into default taxonomies. param: int|object $term If integer, will get from database. If object will apply filters and return $term. param: string $taxonomy Taxonomy name that $term is part of. param: string $output Constant OBJECT, ARRAY_A, or ARRAY_N param: string $filter Optional, default is raw or no WordPress defined filter will applied. return: mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not |
get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') X-Ref |
Get all Term data from database by Term field and data. Warning: $value is not escaped for 'name' $field. You must do it yourself, if required. The default $field is 'id', therefore it is possible to also use null for field, but not recommended that you do so. If $value does not exist, the return value will be false. If $taxonomy exists and $field and $value combinations exist, the Term will be returned. param: string $field Either 'slug', 'name', 'id' (term_id), or 'term_taxonomy_id' param: string|int $value Search for this term value param: string $taxonomy Taxonomy Name param: string $output Constant OBJECT, ARRAY_A, or ARRAY_N param: string $filter Optional, default is raw or no WordPress defined filter will applied. return: mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found. |
get_term_children( $term_id, $taxonomy ) X-Ref |
Merge all term children into a single array of their IDs. This recursive function will merge all of the children of $term into the same array of term IDs. Only useful for taxonomies which are hierarchical. Will return an empty array if $term does not exist in $taxonomy. param: string $term_id ID of Term to get children param: string $taxonomy Taxonomy Name return: array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist |
get_term_field( $field, $term, $taxonomy, $context = 'display' ) X-Ref |
Get sanitized Term field. Does checks for $term, based on the $taxonomy. The function is for contextual reasons and for simplicity of usage. See sanitize_term_field() for more information. param: string $field Term field to fetch param: int $term Term ID param: string $taxonomy Taxonomy Name param: string $context Optional, default is display. Look at sanitize_term_field() for available options. return: mixed Will return an empty string if $term is not an object or if $field is not set in $term. |
get_term_to_edit( $id, $taxonomy ) X-Ref |
Sanitizes Term for editing. Return value is sanitize_term() and usage is for sanitizing the term for editing. Function is for contextual and simplicity. param: int|object $id Term ID or Object param: string $taxonomy Taxonomy Name return: mixed|null|WP_Error Will return empty string if $term is not an object. |
get_terms($taxonomies, $args = '') X-Ref |
Retrieve the terms in a given taxonomy or list of taxonomies. You can fully inject any customizations to the query before it is sent, as well as control the output with a filter. The 'get_terms' filter will be called when the cache has the term and will pass the found term along with the array of $taxonomies and array of $args. This filter is also called before the array of terms is passed and will pass the array of terms, along with the $taxonomies and $args. The 'list_terms_exclusions' filter passes the compiled exclusions along with the $args. The 'get_terms_orderby' filter passes the ORDER BY clause for the query along with the $args array. The 'get_terms_fields' filter passes the fields for the SELECT query along with the $args array. The list of arguments that $args can contain, which will overwrite the defaults: orderby - Default is 'name'. Can be name, count, term_group, slug or nothing (will use term_id), Passing a custom value other than these will cause it to order based on the custom value. order - Default is ASC. Can use DESC. hide_empty - Default is true. Will not return empty terms, which means terms whose count is 0 according to the given taxonomy. exclude - Default is an empty array. An array, comma- or space-delimited string of term ids to exclude from the return array. If 'include' is non-empty, 'exclude' is ignored. exclude_tree - Default is an empty array. An array, comma- or space-delimited string of term ids to exclude from the return array, along with all of their descendant terms according to the primary taxonomy. If 'include' is non-empty, 'exclude_tree' is ignored. include - Default is an empty array. An array, comma- or space-delimited string of term ids to include in the return array. number - The maximum number of terms to return. Default is to return them all. offset - The number by which to offset the terms query. fields - Default is 'all', which returns an array of term objects. If 'fields' is 'ids' or 'names', returns an array of integers or strings, respectively. slug - Returns terms whose "slug" matches this value. Default is empty string. hierarchical - Whether to include terms that have non-empty descendants (even if 'hide_empty' is set to true). search - Returned terms' names will contain the value of 'search', case-insensitive. Default is an empty string. name__like - Returned terms' names will contain the value of 'name__like', case-insensitive. Default is empty string. description__like - Returned terms' descriptions will contain the value of 'description__like', case-insensitive. Default is empty string. The argument 'pad_counts', if set to true will include the quantity of a term's children in the quantity of each term's "count" object variable. The 'get' argument, if set to 'all' instead of its default empty string, returns terms regardless of ancestry or whether the terms are empty. The 'child_of' argument, when used, should be set to the integer of a term ID. Its default is 0. If set to a non-zero value, all returned terms will be descendants of that term according to the given taxonomy. Hence 'child_of' is set to 0 if more than one taxonomy is passed in $taxonomies, because multiple taxonomies make term ancestry ambiguous. The 'parent' argument, when used, should be set to the integer of a term ID. Its default is the empty string '', which has a different meaning from the integer 0. If set to an integer value, all returned terms will have as an immediate ancestor the term whose ID is specified by that integer according to the given taxonomy. The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent' of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc. The 'cache_domain' argument enables a unique cache key to be produced when this query is stored in object cache. For instance, if you are using one of this function's filters to modify the query (such as 'terms_clauses'), setting 'cache_domain' to a unique value will not overwrite the cache for similar queries. Default value is 'core'. param: string|array $taxonomies Taxonomy name or list of Taxonomy names param: string|array $args The values of what to search for when returning terms return: array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist. |
term_exists($term, $taxonomy = '', $parent = 0) X-Ref |
Check if Term exists. Formerly is_term(), introduced in 2.3.0. param: int|string $term The term to check param: string $taxonomy The taxonomy name to use param: int $parent ID of parent term under which to confine the exists search. return: mixed Returns 0 if the term does not exist. Returns the term ID if no taxonomy is specified |
term_is_ancestor_of( $term1, $term2, $taxonomy ) X-Ref |
Check if a term is an ancestor of another term. You can use either an id or the term object for both parameters. param: int|object $term1 ID or object to check if this is the parent term. param: int|object $term2 The child term. param: string $taxonomy Taxonomy name that $term1 and $term2 belong to. return: bool Whether $term2 is child of $term1 |
sanitize_term($term, $taxonomy, $context = 'display') X-Ref |
Sanitize Term all fields. Relies on sanitize_term_field() to sanitize the term. The difference is that this function will sanitize <strong>all</strong> fields. The context is based on sanitize_term_field(). The $term is expected to be either an array or an object. param: array|object $term The term to check param: string $taxonomy The taxonomy name to use param: string $context Default is 'display'. return: array|object Term with all fields sanitized |
sanitize_term_field($field, $value, $term_id, $taxonomy, $context) X-Ref |
Cleanse the field value in the term based on the context. Passing a term field value through the function should be assumed to have cleansed the value for whatever context the term field is going to be used. If no context or an unsupported context is given, then default filters will be applied. There are enough filters for each context to support a custom filtering without creating your own filter function. Simply create a function that hooks into the filter you need. param: string $field Term field to sanitize param: string $value Search for this term value param: int $term_id Term ID param: string $taxonomy Taxonomy Name param: string $context Either edit, db, display, attribute, or js. return: mixed sanitized field |
wp_count_terms( $taxonomy, $args = array() X-Ref |
Count how many terms are in Taxonomy. Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true). param: string $taxonomy Taxonomy name param: array|string $args Overwrite defaults. See get_terms() return: int|WP_Error How many terms are in $taxonomy. WP_Error if $taxonomy does not exist. |
wp_delete_object_term_relationships( $object_id, $taxonomies ) X-Ref |
Will unlink the object from the taxonomy or taxonomies. Will remove all relationships between the object and any terms in a particular taxonomy or taxonomies. Does not remove the term or taxonomy itself. param: int $object_id The term Object Id that refers to the term param: string|array $taxonomies List of Taxonomy Names or single Taxonomy name. |
wp_delete_term( $term, $taxonomy, $args = array() X-Ref |
Removes a term from the database. If the term is a parent of other terms, then the children will be updated to that term's parent. The $args 'default' will only override the terms found, if there is only one term found. Any other and the found terms are used. The $args 'force_default' will force the term supplied as default to be assigned even if the object was not going to be termless param: int $term Term ID param: string $taxonomy Taxonomy Name param: array|string $args Optional. Change 'default' term id and override found term ids. return: bool|WP_Error Returns false if not term; true if completes delete action. |
wp_delete_category( $cat_ID ) X-Ref |
Deletes one existing category. param: int $cat_ID return: mixed Returns true if completes delete action; false if term doesn't exist; |
wp_get_object_terms($object_ids, $taxonomies, $args = array() X-Ref |
Retrieves the terms associated with the given object(s), in the supplied taxonomies. The following information has to do the $args parameter and for what can be contained in the string or array of that parameter, if it exists. The first argument is called, 'orderby' and has the default value of 'name'. The other value that is supported is 'count'. The second argument is called, 'order' and has the default value of 'ASC'. The only other value that will be acceptable is 'DESC'. The final argument supported is called, 'fields' and has the default value of 'all'. There are multiple other options that can be used instead. Supported values are as follows: 'all', 'ids', 'names', and finally 'all_with_object_id'. The fields argument also decides what will be returned. If 'all' or 'all_with_object_id' is chosen or the default kept intact, then all matching terms objects will be returned. If either 'ids' or 'names' is used, then an array of all matching term ids or term names will be returned respectively. param: int|array $object_ids The ID(s) of the object(s) to retrieve. param: string|array $taxonomies The taxonomies to retrieve terms from. param: array|string $args Change what is returned return: array|WP_Error The requested term data or empty array if no terms found. WP_Error if any of the $taxonomies don't exist. |
wp_insert_term( $term, $taxonomy, $args = array() X-Ref |
Add a new term to the database. A non-existent term is inserted in the following sequence: 1. The term is added to the term table, then related to the taxonomy. 2. If everything is correct, several actions are fired. 3. The 'term_id_filter' is evaluated. 4. The term cache is cleaned. 5. Several more actions are fired. 6. An array is returned containing the term_id and term_taxonomy_id. If the 'slug' argument is not empty, then it is checked to see if the term is invalid. If it is not a valid, existing term, it is added and the term_id is given. If the taxonomy is hierarchical, and the 'parent' argument is not empty, the term is inserted and the term_id will be given. Error handling: If $taxonomy does not exist or $term is empty, a WP_Error object will be returned. If the term already exists on the same hierarchical level, or the term slug and name are not unique, a WP_Error object will be returned. param: string $term The term to add or update. param: string $taxonomy The taxonomy to which to add the term param: array|string $args { return: array|WP_Error An array containing the term_id and term_taxonomy_id, WP_Error otherwise. |
wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) X-Ref |
Create Term and Taxonomy Relationships. Relates an object (post, link etc) to a term and taxonomy type. Creates the term and taxonomy relationship if it doesn't already exist. Creates a term if it doesn't exist (using the slug). A relationship means that the term is grouped in or belongs to the taxonomy. A term has no meaning until it is given context by defining which taxonomy it exists under. param: int $object_id The object to relate to. param: array|int|string $terms The slug or id of the term, will replace all existing param: array|string $taxonomy The context in which to relate the term to the object. param: bool $append If false will delete difference of terms. return: array|WP_Error Affected Term IDs |
wp_add_object_terms( $object_id, $terms, $taxonomy ) X-Ref |
Add term(s) associated with a given object. param: int $object_id The ID of the object to which the terms will be added. param: array|int|string $terms The slug(s) or ID(s) of the term(s) to add. param: array|string $taxonomy Taxonomy name. return: array|WP_Error Affected Term IDs |
wp_remove_object_terms( $object_id, $terms, $taxonomy ) X-Ref |
Remove term(s) associated with a given object. param: int $object_id The ID of the object from which the terms will be removed. param: array|int|string $terms The slug(s) or ID(s) of the term(s) to remove. param: array|string $taxonomy Taxonomy name. return: bool|WP_Error True on success, false or WP_Error on failure. |
wp_unique_term_slug($slug, $term) X-Ref |
Will make slug unique, if it isn't already. The $slug has to be unique global to every taxonomy, meaning that one taxonomy term can't have a matching slug with another taxonomy term. Each slug has to be globally unique for every taxonomy. The way this works is that if the taxonomy that the term belongs to is hierarchical and has a parent, it will append that parent to the $slug. If that still doesn't return an unique slug, then it try to append a number until it finds a number that is truly unique. The only purpose for $term is for appending a parent, if one exists. param: string $slug The string that will be tried for a unique slug param: object $term The term object that the $slug will belong too return: string Will return a true unique slug. |
wp_update_term( $term_id, $taxonomy, $args = array() X-Ref |
Update term based on arguments provided. The $args will indiscriminately override all values with the same field name. Care must be taken to not override important information need to update or update will fail (or perhaps create a new term, neither would be acceptable). Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not defined in $args already. 'alias_of' will create a term group, if it doesn't already exist, and update it for the $term. If the 'slug' argument in $args is missing, then the 'name' in $args will be used. It should also be noted that if you set 'slug' and it isn't unique then a WP_Error will be passed back. If you don't pass any slug, then a unique one will be created for you. For what can be overrode in $args, check the term scheme can contain and stay away from the term keys. param: int $term_id The ID of the term param: string $taxonomy The context in which to relate the term to the object. param: array|string $args Overwrite term field values return: array|WP_Error Returns Term ID and Taxonomy Term ID |
wp_defer_term_counting($defer=null) X-Ref |
Enable or disable term counting. param: bool $defer Optional. Enable if true, disable if false. return: bool Whether term counting is enabled or disabled. |
wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) X-Ref |
Updates the amount of terms in taxonomy. If there is a taxonomy callback applied, then it will be called for updating the count. The default action is to count what the amount of terms have the relationship of term ID. Once that is done, then update the database. param: int|array $terms The term_taxonomy_id of the terms param: string $taxonomy The context of the term. return: bool If no terms will return false, and if successful will return true. |
wp_update_term_count_now( $terms, $taxonomy ) X-Ref |
Perform term count update immediately. param: array $terms The term_taxonomy_id of terms to update. param: string $taxonomy The context of the term. return: bool Always true when complete. |
clean_object_term_cache($object_ids, $object_type) X-Ref |
Removes the taxonomy relationship to terms from the cache. Will remove the entire taxonomy relationship containing term $object_id. The term IDs have to exist within the taxonomy $object_type for the deletion to take place. param: int|array $object_ids Single or list of term object ID(s) param: array|string $object_type The taxonomy object type |
clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) X-Ref |
Will remove all of the term ids from the cache. param: int|array $ids Single or list of Term IDs param: string $taxonomy Can be empty and will assume tt_ids, else will use for context. param: bool $clean_taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true. |
get_object_term_cache($id, $taxonomy) X-Ref |
Retrieves the taxonomy relationship to the term object id. param: int|array $id Term object ID param: string $taxonomy Taxonomy Name return: bool|array Empty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id. |
update_object_term_cache($object_ids, $object_type) X-Ref |
Updates the cache for Term ID(s). Will only update the cache for terms not already cached. The $object_ids expects that the ids be separated by commas, if it is a string. It should be noted that update_object_term_cache() is very time extensive. It is advised that the function is not called very often or at least not for a lot of terms that exist in a lot of taxonomies. The amount of time increases for each term and it also increases for each taxonomy the term belongs to. param: string|array $object_ids Single or list of term object ID(s) param: array|string $object_type The taxonomy object type return: null|bool Null value is given with empty $object_ids. False if |
update_term_cache($terms, $taxonomy = '') X-Ref |
Updates Terms to Taxonomy in cache. param: array $terms List of Term objects to change param: string $taxonomy Optional. Update Term to this taxonomy in cache |
_get_term_hierarchy($taxonomy) X-Ref |
Retrieves children of taxonomy as Term IDs. param: string $taxonomy Taxonomy Name return: array Empty if $taxonomy isn't hierarchical or returns children as Term IDs. |
_get_term_children($term_id, $terms, $taxonomy) X-Ref |
Get the subset of $terms that are descendants of $term_id. If $terms is an array of objects, then _get_term_children returns an array of objects. If $terms is an array of IDs, then _get_term_children returns an array of IDs. param: int $term_id The ancestor term: all returned terms should be descendants of $term_id. param: array $terms The set of terms---either an array of term objects or term IDs---from which those that are descendants of $term_id will be chosen. param: string $taxonomy The taxonomy which determines the hierarchy of the terms. return: array The subset of $terms that are descendants of $term_id. |
_pad_term_counts(&$terms, $taxonomy) X-Ref |
Add count of children to parent count. Recalculates term counts by including items from child terms. Assumes all relevant children are already in the $terms argument. param: array $terms List of Term IDs param: string $taxonomy Term Context return: null Will break from function if conditions are not met. |
_update_post_term_count( $terms, $taxonomy ) X-Ref |
Will update term count based on object types of the current taxonomy. Private function for the default callback for post_tag and category taxonomies. param: array $terms List of Term taxonomy IDs param: object $taxonomy Current taxonomy object of terms |
_update_generic_term_count( $terms, $taxonomy ) X-Ref |
Will update term count based on number of objects. Default callback for the link_category taxonomy. param: array $terms List of Term taxonomy IDs param: object $taxonomy Current taxonomy object of terms |
get_term_link( $term, $taxonomy = '') X-Ref |
Generates a permalink for a taxonomy term archive. param: object|int|string $term param: string $taxonomy (optional if $term is object) return: string|WP_Error HTML link to taxonomy term archive on success, WP_Error if term does not exist. |
the_taxonomies($args = array() X-Ref |
Display the taxonomies of a post with available options. This function can be used within the loop to display the taxonomies for a post without specifying the Post ID. You can also use it outside the Loop to display the taxonomies for a specific post. The available defaults are: 'post' : default is 0. The post ID to get taxonomies of. 'before' : default is empty string. Display before taxonomies list. 'sep' : default is empty string. Separate every taxonomy with value in this. 'after' : default is empty string. Display this after the taxonomies list. 'template' : The template to use for displaying the taxonomy terms. param: array $args Override the defaults. |
get_the_taxonomies($post = 0, $args = array() X-Ref |
Retrieve all taxonomies associated with a post. This function can be used within the loop. It will also return an array of the taxonomies with links to the taxonomy and name. param: int $post Optional. Post ID or will use Global Post ID (in loop). param: array $args Override the defaults. return: array |
get_post_taxonomies($post = 0) X-Ref |
Retrieve all taxonomies of a post with just the names. param: int $post Optional. Post ID return: array |
is_object_in_term( $object_id, $taxonomy, $terms = null ) X-Ref |
Determine if the given object is associated with any of the given terms. The given terms are checked against the object's terms' term_ids, names and slugs. Terms given as integers will only be checked against the object's terms' term_ids. If no terms are given, determines if object is associated with any terms in the given taxonomy. param: int $object_id ID of the object (post ID, link ID, ...) param: string $taxonomy Single taxonomy name param: int|string|array $terms Optional. Term term_id, name, slug or array of said return: bool|WP_Error. WP_Error on input error. |
is_object_in_taxonomy($object_type, $taxonomy) X-Ref |
Determine if the given object type is associated with the given taxonomy. param: string $object_type Object type string param: string $taxonomy Single taxonomy name return: bool True if object is associated with the taxonomy, otherwise false. |
get_ancestors($object_id = 0, $object_type = '') X-Ref |
Get an array of ancestor IDs for a given object. param: int $object_id The ID of the object param: string $object_type The type of object for which we'll be retrieving ancestors. return: array of ancestors from lowest to highest in the hierarchy. |
wp_get_term_taxonomy_parent_id( $term_id, $taxonomy ) X-Ref |
Returns the term's parent's term_ID param: int $term_id param: string $taxonomy return: int|bool false on error |
wp_check_term_hierarchy_for_loops( $parent, $term_id, $taxonomy ) X-Ref |
Checks the given subset of the term hierarchy for hierarchy loops. Prevents loops from forming and breaks those that it finds. Attached to the wp_update_term_parent filter. param: int $parent term_id of the parent for the term we're checking. param: int $term_id The term we're checking. param: string $taxonomy The taxonomy of the term we're checking. return: int The new parent for the term. |
create_initial_taxonomies() X-Ref |
Creates the initial taxonomies. This function fires twice: in wp-settings.php before plugins are loaded (for backwards compatibility reasons), and again on the 'init' action. We must avoid registering rewrite rules before the 'init' action. |
get_taxonomies( $args = array() X-Ref |
Get a list of registered taxonomy objects. param: array $args An array of key => value arguments to match against the taxonomy objects. param: string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default. param: string $operator The logical operation to perform. 'or' means only one element return: array A list of taxonomy names or objects |
get_object_taxonomies($object, $output = 'names') X-Ref |
Return all of the taxonomy names that are of $object_type. It appears that this function can be used to find all of the names inside of $wp_taxonomies global variable. <code><?php $taxonomies = get_object_taxonomies('post'); ?></code> Should result in <code>Array('category', 'post_tag')</code> param: array|string|object $object Name of the type of taxonomy object, or an object (row from posts) param: string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default. return: array The names of all taxonomy of $object_type. |
get_taxonomy( $taxonomy ) X-Ref |
Retrieves the taxonomy object of $taxonomy. The get_taxonomy function will first check that the parameter string given is a taxonomy object and if it is, it will return it. param: string $taxonomy Name of taxonomy object to return return: object|bool The Taxonomy Object or false if $taxonomy doesn't exist |
taxonomy_exists( $taxonomy ) X-Ref |
Checks that the taxonomy name exists. Formerly is_taxonomy(), introduced in 2.3.0. param: string $taxonomy Name of taxonomy object return: bool Whether the taxonomy exists. |
is_taxonomy_hierarchical($taxonomy) X-Ref |
Whether the taxonomy object is hierarchical. Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally returns the hierarchical value in the object. A false return value might also mean that the taxonomy does not exist. param: string $taxonomy Name of taxonomy object return: bool Whether the taxonomy is hierarchical |
register_taxonomy( $taxonomy, $object_type, $args = array() X-Ref |
Create or modify a taxonomy object. Do not use before init. A simple function for creating or modifying a taxonomy object based on the parameters given. The function will accept an array (third optional parameter), along with strings for the taxonomy name and another string for the object type. Nothing is returned, so expect error maybe or use taxonomy_exists() to check whether taxonomy exists. Optional $args contents: - label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used. - labels - An array of labels for this taxonomy. * By default tag labels are used for non-hierarchical types and category labels for hierarchical ones. * You can see accepted values in {@link get_taxonomy_labels()}. - description - A short descriptive summary of what the taxonomy is for. Defaults to blank. - public - If the taxonomy should be publicly queryable; //@TODO not implemented. * Defaults to true. - hierarchical - Whether the taxonomy is hierarchical (e.g. category). Defaults to false. - show_ui -Whether to generate a default UI for managing this taxonomy in the admin. * If not set, the default is inherited from public. - show_in_menu - Where to show the taxonomy in the admin menu. * If true, the taxonomy is shown as a submenu of the object type menu. * If false, no menu is shown. * show_ui must be true. * If not set, the default is inherited from show_ui. - show_in_nav_menus - Makes this taxonomy available for selection in navigation menus. * If not set, the default is inherited from public. - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget. * If not set, the default is inherited from show_ui. - meta_box_cb - Provide a callback function for the meta box display. * If not set, defaults to post_categories_meta_box for hierarchical taxonomies and post_tags_meta_box for non-hierarchical. * If false, no meta box is shown. - capabilities - Array of capabilities for this taxonomy. * You can see accepted values in this function. - rewrite - Triggers the handling of rewrites for this taxonomy. Defaults to true, using $taxonomy as slug. * To prevent rewrite, set to false. * To specify rewrite rules, an array can be passed with any of these keys * 'slug' => string Customize the permastruct slug. Defaults to $taxonomy key * 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true. * 'hierarchical' => bool Either hierarchical rewrite tag or not. Defaults to false. * 'ep_mask' => const Assign an endpoint mask. * If not specified, defaults to EP_NONE. - query_var - Sets the query_var key for this taxonomy. Defaults to $taxonomy key * If false, a taxonomy cannot be loaded at ?{query_var}={term_slug} * If specified as a string, the query ?{query_var_string}={term_slug} will be valid. - update_count_callback - Works much like a hook, in that it will be called when the count is updated. * Defaults to _update_post_term_count() for taxonomies attached to post types, which then confirms that the objects are published before counting them. * Defaults to _update_generic_term_count() for taxonomies attached to other object types, such as links. - _builtin - true if this taxonomy is a native or "built-in" taxonomy. THIS IS FOR INTERNAL USE ONLY! param: string $taxonomy Taxonomy key, must not exceed 32 characters. param: array|string $object_type Name of the object type for the taxonomy object. param: array|string $args See optional args description above. return: null|WP_Error WP_Error if errors, otherwise null. |
get_taxonomy_labels( $tax ) X-Ref |
Builds an object with all taxonomy labels out of a taxonomy object Accepted keys of the label array in the taxonomy object: - name - general name for the taxonomy, usually plural. The same as and overridden by $tax->label. Default is Tags/Categories - singular_name - name for one object of this taxonomy. Default is Tag/Category - search_items - Default is Search Tags/Search Categories - popular_items - This string isn't used on hierarchical taxonomies. Default is Popular Tags - all_items - Default is All Tags/All Categories - parent_item - This string isn't used on non-hierarchical taxonomies. In hierarchical ones the default is Parent Category - parent_item_colon - The same as <code>parent_item</code>, but with colon <code>:</code> in the end - edit_item - Default is Edit Tag/Edit Category - view_item - Default is View Tag/View Category - update_item - Default is Update Tag/Update Category - add_new_item - Default is Add New Tag/Add New Category - new_item_name - Default is New Tag Name/New Category Name - separate_items_with_commas - This string isn't used on hierarchical taxonomies. Default is "Separate tags with commas", used in the meta box. - add_or_remove_items - This string isn't used on hierarchical taxonomies. Default is "Add or remove tags", used in the meta box when JavaScript is disabled. - choose_from_most_used - This string isn't used on hierarchical taxonomies. Default is "Choose from the most used tags", used in the meta box. - not_found - This string isn't used on hierarchical taxonomies. Default is "No tags found", used in the meta box. Above, the first default value is for non-hierarchical taxonomies (like tags) and the second one is for hierarchical taxonomies (like categories). param: object $tax Taxonomy object return: object object with all the labels as member variables |
register_taxonomy_for_object_type( $taxonomy, $object_type) X-Ref |
Add an already registered taxonomy to an object type. param: string $taxonomy Name of taxonomy object param: string $object_type Name of the object type return: bool True if successful, false if not |
unregister_taxonomy_for_object_type( $taxonomy, $object_type ) X-Ref |
Remove an already registered taxonomy from an object type. param: string $taxonomy Name of taxonomy object. param: string $object_type Name of the object type. return: bool True if successful, false if not. |
get_objects_in_term( $term_ids, $taxonomies, $args = array() X-Ref |
Retrieve object_ids of valid taxonomy and term. The strings of $taxonomies must exist before this function will continue. On failure of finding a valid taxonomy, it will return an WP_Error class, kind of like Exceptions in PHP 5, except you can't catch them. Even so, you can still test for the WP_Error class and get the error message. The $terms aren't checked the same as $taxonomies, but still need to exist for $object_ids to be returned. It is possible to change the order that object_ids is returned by either using PHP sort family functions or using the database by using $args with either ASC or DESC array. The value should be in the key named 'order'. param: int|array $term_ids Term id or array of term ids of terms that will be used param: string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names param: array|string $args Change the order of the object_ids, either ASC or DESC return: WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success |
get_tax_sql( $tax_query, $primary_table, $primary_id_column ) X-Ref |
Given a taxonomy query, generates SQL to be appended to a main query. param: array $tax_query A compact tax query param: string $primary_table param: string $primary_id_column return: array |
Generated: Tue Mar 25 01:41:18 2014 | WordPress honlapkészítés: online1.hu |