In WordPress, the “term” is an item in a taxonomy. So if you have added some categories to your posts, each of those categories is defined as a term in the category of taxonomy. Now a new question will arise i.e. What is “taxonomy”?
So in WordPress, a “taxonomy” is one of those words that most people never hear or use. Basically, a taxonomy is a way of grouping things together. The name for different groupings in taxonomy is called terms.
The basic diagram on taxonomies and their relationships in WordPress :
For example, if we have a bunch of different types of animals. We can group them together according to various characteristics and then assign those groups names. Using groupings of animals, we might call one group “birds”, and another group “fish”. “Fish” and “birds” are terms in our taxonomy. As an example from WordPress, a category or tag (see next section) is a term.
You can add taxonomy terms by going to the taxonomy editing screen (e.g. Posts > Categories) or by adding them when you’re editing a post.
How WordPress stores Taxonomies and Terms?
WordPress uses a one-to-many relationship, which is created by using three tables.
WordPress comes with three built-in taxonomies, that are:
- Link Category
The relationship can be understood by –
Where categories and tags are a bit like posts and pages in that they are the same type of content (taxonomies) but behave differently by default, in that categories are hierarchical and tags are not.
Similarly, the link category taxonomy works somewhat in a similar way to tags and could theoretically be used for any object type, but by default, it is not displayed in the post editing screen and is in the link editing screen if links have been enabled.
Though Get Term offers some handy information, unfortunately, it lacks a link value.
|$term = get_term( $term_id, $taxonomy );|
Gives you term slug: e.g.: term-slug-example
$slug = $term->slug;
Gives you term name: e.g. Term Name Example
$name = $term->name;
Gives you term description: e.g. This is my new cool custom term.
$desc = $term->description;
Terms and Taxonomies are a powerful WordPress feature which let you add much more flexibility to your sites. They are related to two other content types that are the posts and the links, and the database structure means that this is a many-to-many relationship, where one post can have multiple terms across multiple taxonomies, and one term can be assigned to multiple posts or links.