WordPress at a glance
Главная Functions Taxonomies (Categories, Tags)

Category: Taxonomies (Categories, Tags) 4

get_ancestors()

Get an array of ancestor IDs for a given object.

get_term_parents_list()

Retrieve term parents with separator.

wp_get_split_terms()

Get data about terms that previously shared a single term_id, but have since been split.

wp_terms_checklist()

Output an unordered list of checkbox input elements labelled with term names.

Metadata (termmeta)

add_term_meta()

Adds metadata to a term.

delete_term_meta()

Removes metadata matching criteria from a term.

get_term_meta()

Retrieves metadata for a term.

has_term_meta()

Get all meta data, including meta IDs, for the given term ID.

update_term_meta()

Updates term metadata.

Categories

cat_is_ancestor_of()

Check if a category is an ancestor of another category.

category_description()

Retrieve category description.

get_cat_ID()

Retrieve the ID of a category from its name.

get_cat_name()

Retrieve the name of a category from its ID.

get_categories()

Retrieve list of category objects.

get_category()

Retrieves category data given a category ID or category object.

get_category_by_slug()

Retrieve category object by category slug.

get_category_link()

Retrieve category link URL.

get_category_parents()

Retrieve category parents with separator.

get_the_category_by_ID()

Retrieve category name based on category ID.

in_category()

Check if the current post is within any of the given categories.

single_cat_title()

Display or retrieve page title for category archive.

wp_create_category()

Add a new category to the database if it does not already exist.

wp_dropdown_categories()

Display or retrieve the HTML dropdown list of categories.

wp_insert_category()

Updates an existing Category or creates a new Category.

wp_list_categories()

Displays a list of categories as HTML links. If you click on the link, all posts from the category will be shown.

Tags

edit_tag_link()

Displays or retrieves the edit link for a tag with formatting.

get_tag_link()

Retrieve the link to the tag.

get_tags()

Retrieves all post tags.

single_tag_title()

Display or retrieve page title for tag post archive.

tag_description()

Retrieve tag description.

wp_generate_tag_cloud()

Generates a tag cloud (heatmap) from provided data.

wp_tag_cloud()

Display tag cloud. The text size is set by the 'smallest' and 'largest' arguments, which will use the 'unit' argument value for the CSS text size unit. The 'format' argument can be 'flat' (default), 'list', or 'array'. The flat value for the 'format' argument will separate tags with spaces. The list value for the 'format' argument will format the tags in a UL HTML list. The array value for the 'format' argument will return in PHP array type format.

Any taxonomy

edit_term_link()

Displays or retrieves the edit term link with formatting.

get_edit_term_link()

Retrieves the URL for editing a given term.

get_taxonomies()

Retrieves a list of registered taxonomy names or objects.

get_taxonomy()

Retrieves the taxonomy object of $taxonomy.

get_term()

Get all Term data from database by Term ID.

get_term_by()

Get all Term data from database by Term field and data.

get_term_children()

Merge all term children into a single array of their IDs.

get_term_field()

Get sanitized Term field.

get_term_link()

Generate a permalink for a taxonomy term archive.

get_terms()

Retrieve the terms in a given taxonomy or list of taxonomies.

is_taxonomy_hierarchical()

Whether the taxonomy object is hierarchical.

register_taxonomy()

Creates or modifies a taxonomy object.

register_taxonomy_for_object_type()

Add an already registered taxonomy to an object type.

sanitize_term()

Sanitize Term all fields.

sanitize_term_field()

Cleanse the field value in the term based on the context.

single_term_title()

Display or retrieve title for the current taxonomy (category, tag, etc.). Uses on term archive pages.

taxonomy_exists()

Checks that the taxonomy name exists.

term_description()

Retrieve term description.

term_exists()

Check if Term exists.

term_is_ancestor_of()

Check if a term is an ancestor of another term.

the_terms()

Display the terms in a list.

unregister_taxonomy()

Unregisters a taxonomy.

wp_count_terms()

Count how many terms are in Taxonomy.

wp_delete_term()

Removes a term from the database.

wp_get_term_taxonomy_parent_id()

Returns the term's parent's term_ID.

wp_insert_term()

Adds a new taxonomy element (term, category) into a database.

wp_update_term()

Update term based on arguments provided.

For posts

get_object_taxonomies()

Return the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name.

get_objects_in_term()

Retrieve object_ids of valid taxonomy and term.

get_the_category()

Retrieve post categories.

get_the_category_list()

Retrieve category list for a post in either HTML list or custom format.

get_the_tag_list()

Retrieve the tags for a post formatted as a string.

get_the_tags()

Retrieve the tags for a post.

get_the_taxonomies()

Retrieve all taxonomies associated with a post.

get_the_term_list()

Retrieve a post's terms as a list with specified format.

get_the_terms()

Retrieve the terms of the taxonomy that are attached to the post.

has_category()

Checks whether the current or specified post has at least one of the specified categories.

has_tag()

Check if the current post has any of given tags.

has_term()

Check if the current post has any of given terms.

is_object_in_taxonomy()

Determine if the given object type is associated with the given taxonomy.

is_object_in_term()

Determine if the given object is associated with any of the given terms.

the_category()

Display category list for a post in either HTML list or custom format.

the_tags()

Retrieve the tags for a post.

the_taxonomies()

Display the taxonomies of a post with available options.

wp_delete_object_term_relationships()

Will unlink the object from the taxonomy or taxonomies.

wp_get_object_terms()

Retrieves the terms associated with the given object(s), in the supplied taxonomies.

wp_get_post_categories()

Retrieve the list of categories for a post.

wp_get_post_tags()

Gets a list of tags for a specified post as an array.

wp_get_post_terms()

Gets the elements of the specified taxonomy (tag, category) to which specified post is associated.

wp_remove_object_terms()

Remove term(s) associated with a given object.

wp_set_object_terms()

Create Term and Taxonomy Relationships.

wp_set_post_categories()

Set categories for a post.

wp_set_post_tags()

Set the tags for a post.

wp_set_post_terms()

Set the terms for a post.