If you are a WordPress website or blog owner, you must have heard about the term Taxonomy which is mainly used to classify and group the content of your WordPress site into different groups or classifications. In today's article, we will explain this concept in detail and show you how important it is for your website. We will also explain how to create custom classifications and explain how to deal with them on websites that need specific requirements in two ways (through ready-made plugins, and manually through code). What is Taxonomy in WordPress?
Classification on a WordPress site - or on any website in general - is a way that enables you to classify and sort the content of your site or blog and organize it into different categories. For example. If you have an educational website through which you provide training courses on various topics, you will need to add a classification for each training course that you add to the site.
For example (computer, mathematics, English language, electronic marketing, etc.) These classifications enable you to organize the site’s courses into different sections so that the content of your site does not become random, crowded, and difficult to manage. In addition, it contributes to improving the search engines of your site and helps it identify related content.
By default, WordPress has two types of classifications automatically built into it to help you with this task: categories and tags, which usually appear on the left side of the component editor when editing any article on the site. Categories and tags on the WordPress site Note: To avoid confusion between the concept of classification (Taxonomy) in the general sense, which we are talking about in this article, and the classification (Category) that the WordPress system provides to you itself - which is considered one of the types of general classifications - we will from now on refer to the first as taxonomy and to the second as classification.
What is the difference between categories and tags in WordPress?
As we previously mentioned, when publishing any article on your WordPress site, you can add classifications and tags to this article, both of which are considered a type of taxonomy that WordPress provides in a ready-made way to organize the content. Here are the most notable differences between categories and tags: Categories are used to group similar articles on the site together, while tags are used to describe the site’s articles with semantic words that describe their content and facilitate the process of searching for articles that include the same tags. You can add site-specific categories, write a description for them, and edit them through your WordPress site’s control panel< مقالات < تصنيفات ، وبشكل مشابه يمكنك إضافة وتحرير الوسوم من خلال لوحة تحكم موقع ووردربس واختيار < مقالات < وسوم .
Categories in WordPress are mandatory, as you must put at least one category for your article, and if you do not specify any category, it will be published under the default category (Uncategorized), while tags are optional and you are not obligated to place them for your articles. Categories in WordPress are organized hierarchically. You can create a parent category and child categories for this category, while tags cannot be hierarchical, but rather be all on one horizontal level (flat).
Read more: What are hashtags?
How is it different from classifications? How do you benefit from it on your site? What is the difference between taxonomy and categories and tags in WordPress?
Taxonomy refers to the concept of collecting website posts in general. As for categories and tags, they are ready-made methods that the WordPress system provides for you to collect your articles and organize them hierarchically or horizontally. For example, let us assume that you have a website that provides food recipes. In this case, you can classify the recipes in the following hierarchical manner according to countries (father classification for Arabic recipes, and below it are 4 sons’ classifications (Levantine, Gulf, Egyptian, Moroccan recipes).
There is a second classification for international recipes, and below it there are 3 sons’ classifications: (Italian, Chinese, and Indian recipes). You can also specify tags for specific recipes on your site to show, for example, the most important ingredients included in these recipes (meat, vegetables, starches, eggs...) to help find specific recipes that include specific ingredients, even if they fall within the classifications of different countries. WordPress hierarchical categories Most sites may be satisfied with customizing content using these categories and tags provided by WordPress, but sometimes you may need to group your site’s content based on different criteria. In the previous example of the food recipes website, what if you needed to classify the recipes based on an additional criterion, such as classifying them based on the preparation time required to prepare and cook the entire recipe?
How will you add this feature? In this case, you will need to create a new taxonomy specifically for your site, and give it the name you want, for example, Cooking time. You will also need to create the vocabulary or terms that this taxonomy includes, such as (short, medium, long), and link this taxonomy to your site’s articles about recipes. Custom taxonomy It is worth noting that custom taxonomy in WordPress can be hierarchical, similar to taxonomy, or be at a single level, such as tags.
It depends on your site's specific requirements. How to create a custom Taxonomy in WordPress? There are several ways through which you can create your own custom taxonomy on a WordPress website, and the easiest of these ways is by using ready-made WordPress plugins. Fortunately, there are many plugins that provide the advantage of creating custom classifications in WordPress easily and without the need for programming experience. The most prominent of these plugins are: Custom Post Type UI plugin: This plugin was created by Pluginize to enable site owners to manage both custom post types and custom classifications for a WordPress site using an easy-to-use graphical interface.
Pods – Custom Content Types and Fields: This add-on also enables you to expand and create custom content types including custom post types, custom taxonomies, and your own advanced content types easily with one click. Read also: Custom Post and ways to use and create it in WordPress. It is also possible to create custom categories on your site through code, but this method requires you to have knowledge of writing and modifying code in WordPress, dealing with template files and plugins, and the basics of how hooks work in WordPress. 1.
Create a custom Taxonomy using the Custom Post Type UI plugin. In this paragraph, we will explain how to use the plugin to create custom Taxonomy categories for a WordPress site using the Custom Post Type UI plugin. This plugin includes a lot of details because it is used to create both custom posts and custom categories on a WordPress site, as mentioned in the previous paragraph.
But in this article, we will use the plugin to create a custom category only, and we will call it (Cooking time), and we will attach it to the default WordPress articles, and you can of course attach it to any custom content type that you create on your site. Go to Control Panel and choose Add-ons< أضف جديد< وابحث عن اسم الإضافة Custom Post Type UI ثم قم بتنصيب الإضافة وتفعيلها على موقعك. بعد تفعيل الإضافة في موقعك ستلاحظ ظهور عنصر جديد في الشريط الجانبي للوحة تحكم موقعك باسم CPT UI ، انقر فوق هذا الاسم واختر من القائمة الظاهرة الخيار Add/Edit Taxonomy لإضافة التاكسونومي المخصصة في الموقع وتحريرها.
A window for setting up the new Taxonomy will appear. This window includes a very long list of different options for customizing Taxonomy, but here we will stick to the basic settings. First, we will set up the basic options in the Basic Settings section, shown in the following image (the fields with * next to them are mandatory fields and the other fields are optional): Taxonomy Slug: From here we specify the nice name for taxonomy (cook_time). This name must contain numbers of letters in the English language only, and the uppercase letters in it are automatically converted to lowercase letters, as this name is used in the URL and in WordPress queries.
Plural Label: From here we specify the name of the taxonomy in the plural form (cook_times) Singular Label: From here we specify the name of the taxonomy in the singular form (cook_time) Auto-populate labels Through this option you can allow the add-on to automatically fill in the rest of the label fields on your behalf. Attach to Post Type: Through this option you can specify what type of posts you want to associate this taxonomy with (here we chose WP Core articles). There are several other settings that you can customize from this window. For example, in the settings section, you can specify whether this taxonomy is a general classification through which users can filter and search content, or a private classification.
You can also specify whether taxonomy is hierarchical, meaning whether it uses a parent/child relationship such as categories or a single-level list such as tags. Depending on the options you choose, the taxonomy will appear on the site. The plugin has many other options, and in this article we have limited ourselves to the basic options related to creating a hierarchical taxonomy to classify our site’s articles.
I suggest you take a look at the full list of options on the official page of the extension and configure it to suit your requirements. After you have finished selecting all the options, click on the Add Taxonomy button and go to the site’s control panel < مقالات واستعرض مقالات الموقع، ثم قم بإضافة مقال جديد أو تحرير مقال سابق وستلاحظ ظهور التاكسونومي الجديد في كقائمة فرعية ضمن قائمة المقالات عند النقر عليه ستظهر لك صفحة إعداد مفردات التصنيف كما يلي: نظرًا لأننا أضفنا هذا التصنيف للمقالات الافتراضية في ووردبريس وحددنا أنه سيظهر بشكل هرمي، فعند الانتقال لتحرير أي مقال من مقالات الموقع سيظهر لنا هذا التصنيف في الشريط الجانبي لمحرر الموقع عند تحرير المقالات. يمكنك من هنا كذلك إنشاء مصطلحات جديدة ذات صلة بالتاكسونومي الجديد لتجميع وصفات الموقع بحسب وقت الطهي اللازم لها على سبيل المثال إضافة مصطلح جديد للوصفات بالنقر على رابط Add new cook_time وإضافة زمن جديد للوصفات التي تستغرق أكثر من ساعتين للطهي كما هو مبين في الصورة التالية: 2.
Create a custom Taxonomy manually through code. In this paragraph, we will explain how to add a custom Taxonomy category to a WordPress site through code without the need for external add-ons. We will be adding our code to the website template, so we need to access the functions.php file for our current website template. You can access this file through the following path: public_html/wp-content/theme_name, as this is the name of the template activated on your site.
Open the function.php file in any code editor or choose from the control panel Appearance Template File Editor and select the function.php file for the template to edit it from within the control panel and write the following code at the end and save the changes. This code creates a new taxonomy named cooking time and we will make it here a hierarchical taxonomy like classifications. You may, of course, need to modify this code depending on the nature of the classification that you want to create on your site. function wpar_register_taxonomy_cooking_time() { $labels = array( 'name' => _x( 'cooking_time', 'taxonomy general name' ), 'singular_name' => _x( 'cooking_time', 'taxonomy singular name' ), 'search_items' => __( 'Search cooking_time' ), 'all_items' => __( 'All cooking_time' ). __( 'New cooking_time Name' ), 'menu_name' => __( 'cooking_time' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => [ 'slug' => 'cooking_time' ], 'show_in_rest' => true, ); register_taxonomy( 'cooking_time', [ 'post' ], $args ); } add_action( 'init', 'wpar_register_taxonomy_cooking_time' ); The classification we created uses the init hook to bind the custom function wpar_register_taxonomy_cooking_time(), which includes calling the ready-made function in WordPress register_taxonomy() responsible for creating or modifying the taxonomy, which has the following general form register_taxonomy( string $taxonomy, array|string $object_type, array|string $args = array()) We can pass to this function three arguments as follows: $taxonomy is A text string representing the name of Taxonomy cooking_time $object_type An array or text string that specifies the type of posts we want to link Taxonomy to, which in our case are default WordPress posts [‘post’ ] $args An array of parameters that define Taxonomy specifications. To learn more about how to use this function and all the parameters and specifications that can be specified for Taxonomy, I recommend looking at the following link. After saving the changes to the template functions code file function.php, we can go from New to the website control panel < مقالات < نلاحظ ظهور عنصر جديد باسم cooking_time بالنقر عليه تظهر لنا النافذة التي تمكننا من إضافة مفردات خاصة بالتاكسونومي الجديد كما يلي: الأن إذا قمنا بإنشاء أو تعديل أي مقال من مقالات موقعنا فسوف نلاحظ ظهور اسم التاكسونومي المخصص cooking time على الشريط الجانبي في نافذة تحرير المقال أسفل الوسوم كي نصنف مقالاتنا بناء عليه كما يلي: ملاحظة: يفضل القيام بهذه التعديلات البرمجية ضمن قالب ابن كي لا نفقد التعديلات التي قمت بها في حال تحديث قالب الموقع، كما يمكن كذلك بدلاً من ذلك إنشاء إضافة مخصصة وتضمين الكود من خلالها ضمن الموقع. وأنصح بالاطلاع على الرابط التالي للتعرف على المزيد حول تخصيص التاكسونومي برمجيًا في ووردبريس.
Read also: How to develop WordPress plugins yourself to create automated functions. Conclusion: In today’s article, we learned about the concept of taxonomy and its importance in WordPress sites that need custom classification requirements for content. We also learned how to add it to a WordPress site and how to customize it on the site in several ways. All you have to do is choose the method that suits you and organize your site's content.
Do you use a special Taxonomy taxonomy on your website? Tell us why you use it and how you set it up in the comments below the article.
DROPIDEA
We hope this article has added real value to you. At DROPIDEA, we always strive to deliver high-quality content that helps you grow and evolve in the digital space. Follow us for more useful articles and guides.
Admin
DROPIDEA
Latest Articles
“Nofollow” tag: What it is, how and where it is used, “Infographics”
ASUS ROG Flow Z13 (2025) available: Everything you could dream of in a gaming tablet.
The best 5 sites to download safe computer programs without malware!
Create a forum on WordPress using the bbPress plugin step by step