WordPress custom taxonomies – CyberSEO Pro

WordPress custom taxonomies – CyberSEO Pro

In this article, we will look at the basics of WordPress custom taxonomies and how to master them using the CyberSEO Pro and RSS Retriever plugins.

What are custom taxonomies?

WordPress taxonomies are mechanisms to categorize and sort the content on your site. Think of them as an advanced filing system that goes beyond the basic ‘categories’ and ‘tags.’ By using Custom Taxonomies, you can design a more intricate, relevant categorization framework, especially for custom post types. For example, if you have a custom post type for “Books,” you can have custom taxonomies such as “Topics” to further sort them into genres like Adventure, Romance, Horror, etc.

Why custom taxonomies are useful

  1. Custom Taxonomies give you the granularity you need, allowing for detailed organization schemes. You can take a custom post type like “Recipes” to the next level by adding specific taxonomies such as “Courses” and “Ingredients.”
  2. The structure can go deeper with hierarchical taxonomies. For example, if you have a taxonomy for “Fiction,” it can encompass sub-categories like Adventure, Romance, and Horror, giving you a nested, intuitive structure for content.
  3. Ease of management comes standard with Custom Taxonomies as they have their own dedicated menus in the WordPress admin panel. This makes it straightforward to manage even the most complex categorization systems.
  4. The benefits extend to clients as well, especially those who frequently add new content. Custom Taxonomies can be designed to suit the intuitive nature of a business, making the data input process smoother.

Selecting post types

When you are setting up feeds for syndication, CyberSEO Pro allows you to choose from a drop-down menu for “Post types.” This list includes all post types defined either by the WordPress theme or by other active plugins like WooCommerce.

CyberSEO Pro post type

Additional custom taxonomies block

Once a custom post type with its own taxonomies is selected, an additional “Custom Taxonomies” block appears in the settings. This block displays all the taxonomy names followed by text fields where you can enter their values.

CyberSEO Pro custom taxonomies

Shortcode support

Starting with version 10.115, CyberSEO Pro, along with the RSS Retriever plugin, supports post template shortcodes like %post_tags%, %xml_tags[name]%, %custom_fields[name]%, etc. This allows you to automatically populate your custom taxonomies when syndicating posts from different sources.

Example

Let’s say you’re importing an XML file where each item follows this structure:

<item>
    <title>2-Pack 2700mAh 7.6V 20.52Wh Lipo Upgrade Battery</title>
    <brand>Parrot</brand>
    ...
</item>

In this scenario, assume you’re creating WordPress posts with a custom post type that has a custom taxonomy named “Product brand”. You’d like to populate this taxonomy using the <brand> field from the XML file.

To do so, navigate to the “Custom taxonomies” settings block for your feed in CyberSEO Pro or RSS Retriever, and simply input the following shortcode in the “Product brand” field:

%xml_tags[brand]%

This shortcode will automatically retrieve the value between the <brand> tags from each XML element and populate the “Product brand” custom taxonomy when the post is syndicated.

By using this shortcode functionality, you can streamline your content syndication process while ensuring that all relevant custom taxonomies are populated accurately.

PHP code snippets

For advanced users, custom taxonomies can also be assigned using custom PHP code. For example, the following code will assign “Galaxy Z Fold5” to the custom taxonomy “model”:

$post['custom_taxonomies']['model'] = 'Galaxy Z Fold5';

In the example above, the model custom taxonomy name must be defined for the selected post type.

Useful tools

While CyberSEO Pro and RSS Retriever offer robust capabilities for handling WordPress custom post types and taxonomies defined by your active theme or other plugins, it’s important to note that these plugins are not designed to create or manage these custom elements. They excel at importing and syndicating content within the framework you’ve established but leave the actual structuring to other specialized tools.

For users looking to easily create and manage custom post types and taxonomies, we highly recommend using the free plugin Custom Post Type UI. This tool provides an intuitive interface for registering and managing these custom elements, making it a perfect companion to CyberSEO Pro and RSS Retriever. Together, these plugins offer a comprehensive solution for both the structure and content of your WordPress site.

Source: https://www.cyberseo.net/blog/wordpress-custom-taxonomies/