Taxonomy is the way of grouping things together. In wordpress way, it can be the way we can group pages, post or custom post together. By default wordpress has three built in taxonomies as: – Category – Tag and – Link Category Category Category can serve as taxonomy, in order to differentiate and group posts. […]
Taxonomy is the way of grouping things together. In wordpress way, it can be the way we can group pages, post or custom post together. By default wordpress has three built in taxonomies as:
- Tag and
- Link Category
Category can serve as taxonomy, in order to differentiate and group posts. A hierarchical structure of categories can be formed by interrelating categories and sub categories to each other.
Tags can provide flexibility of categorising or grouping. It provides more freedom and can be keyword based. For example a post can be tagged in different keyword, it doesn't need to be one of the predefined categories.
As the name goes, link category provide a way to categorise links. Its a handy way of defining groups of links in different locations of the templates such as sidebars.
As of wordpress version 2.3, we can create our own taxonmoy. This is called custom taxonomy and provides a solid way to group and classify various items such as post, custom posts etc in different ways.
How is Custom Taxonomy created and used?
Wordpress core has a predefined function called register_taxonomy(), which does most of things needed to create a custom taxonomy.
A custom taxonomy is defined as:
<?php register_taxonomy( $taxonomy_name, $object_types, $arguments ); ?>
The function takes 2 mandatory parameters ie($taxonomy_name, $object_types) and one optional parameter($arguments).
$taxonomy_name- It is mandatory string field, and is the name of the taxonomy.
$object_types - It is mandatory parameter, and is the name of the object type for the taxonomy object.
$arguments - Its optional parameter, and takes an array of arguments
Here is the link for details explanation of register_taxonomy function.
Wordpress taxonomy is the term used to categorise wordpress content under various categories. By default wordpress has 3 taxonomy. If there is need for better organisation and classification, wordpress provides the way to create the custom taxonomy, which can be customised as the requirements.