Reputation: 466
I want to know real difference between taxonomy,category and tag in wordpress.
can we use them interchangeably?
Upvotes: 3
Views: 6545
Reputation: 9951
Here is a copy of a post I have recently done on WPSE regarding this matter
Taxonomies, as previously described are a collective noun for the following
category
post_tag
post_format
link_category
custom taxonomy
The first four are built-in taxonomies, while custom taxonomies are taxonomies that are manually created by the user with register_taxonomy
. Custom Taxonomies can be hierarchical (like the build-in taxonomy category
) or not (like post tags)
The categories and tags that you create in the back end under the 'Posts' screen are in actual fact terms of the taxonomies category
and post_tag
You cannot create extra terms in post_format
. post_format
have the build in terms like post_format_video
, post_format_gallery
etc. See the codex for all post formats included
EDIT
I have updated the Taxonomies page in the codex to include my diagram and the missing post_format
taxonomy
Upvotes: 1
Reputation: 7352
Categories and tags are taxonomies, they are just built-in and associated with the "Post" post type (which is also built-in).
However, there are two types of taxonomies -- hierarchical and not-hierarchical. The former's terms ("term" is just a fancy word for a taxonomy entry) can have sub-terms, for example:
Category
- Subcategory 1
- Subcategory 2
- Subcategory 3
-- Subcategory 3.1
-- Subcategory 3.2
etc.
As you probably guessed, Tags are non-hierarchical and Categories are hierarchical (you can't have sub-tags, but you can have sub-categories).
Another noticeable difference is that when you have a hierarchical taxonomy for a post, you can select its terms using checkboxes in the admin, while for the non-hierarchical ones you have just a text field for entering the term's name.
You can register your own custom taxonomies and choose whether they are hierarchical or not and add them to post type(s) using the register_taxonomy() function.
Using taxonomies interchangeably depends on how you are trying to group your posts and if they need to fall into sub-groups and also if those groups' logic match the taxonomy's name.
For example it is probably not a great idea to have terms such as "red", "green" and "yellow" in a taxonomy called "Sizes", but more like in a taxonomy called "Colors".
Further reading -- https://codex.wordpress.org/Taxonomies
Upvotes: 3
Reputation: 27102
Categories provide a helpful way to group related posts together, and to quickly tell readers what a post is about. Categories also make it easier for people to find your content. Categories are similar to, but broader than, tags.
Tags are similar to categories, and can be thought of as micro-categories.
Categories and Tags are both default taxonomies. In fact, there are four default taxonomies: category
, post_tag
, link_category
, post_format
. In addition, you can define your own custom taxonomies.
Upvotes: 1