Home » Custom Posts and Fields » Creating Custom Taxonomies

Creating Custom Taxonomies

This guide explains how to create custom taxonomies in QuickBuildWP.


1. Creating a Custom Taxonomy

To create a custom taxonomy, follow these steps:
  1. Navigate to: WordPress Admin Dashboard → QuickBuildWP → Field Groups.
  2. Add New Field: Click Add New Field in the desired Field Group.
  3. Set Field Type: Choose Dropdown or TREE as the field type.
  4. Use the Options Field: Add taxonomy-related settings in JSON format.

2. JSON Configuration for Custom Taxonomies

Define taxonomies using the following JSON format in the Options Field:
{
  "options": [
    {
      "name": "taxonomy",
      "value": "TAXONOMY NAME",
      "display_name": "TAXONOMY DISPLAY NAME",
      "hierarchical": 1,
      "native": 1
    }
  ]
}

3. JSON Field Descriptions

Field Description
name Set to taxonomy to register a new taxonomy.
value The internal name of the taxonomy. Example: If the Field Group name is listing, the taxonomy is stored as qb_listing_category. The prefix qb_ is hardcoded in the plugin.
display_name The display name for identifying the taxonomy.
rewrite If not specified, the default frontend URL follows the format FIELDGROUP-TAXONOMY (e.g. widget-category). However, you can customize it to create an SEO-friendly URL by using relevant keywords. This customization applies only to the frontend; the default format will still be used in the admin panel. Setting a custom slug for the taxonomy enhances URL structure and improves SEO. For instance "rewrite": "elementor-widgets", the URL will appear as /elementor-widgets/footer/, making it more user-friendly and optimized for search engines.
hierarchical Set to 1 for parent-child relationships. Exclude this key for flat taxonomies.
native Set to 1 to use WordPress's default taxonomy display. When hierarchical is 1, a tree-like structure is displayed. If not, the system will use a tag-like meta box for value selection.

4. Example Use Case: Registering a Category Taxonomy

To create a Categories taxonomy with a parent-child structure, use the following JSON in the Options Field:
{
  "options": [
    {
      "name": "taxonomy",
      "value": "category",
      "display_name": "Categories",
      "hierarchical": 1,
      "native": 1
    }
  ]
}
  • This creates a hierarchical taxonomy named Categories, allowing parent-child relationships.

5. Displaying Taxonomies

  • If Hierarchical is set to 1, the taxonomy is displayed as a Tree Structure.
  • If Hierarchical is not set, the taxonomy is displayed as a Tag-like Meta Box, where users can type values directly.

By following this guide, you can create, configure, and display custom taxonomies in QuickBuildWP, offering powerful ways to categorize and manage your data.