Smackcoders
0
0

Creating Custom Taxonomies Using the ACF Plugin: A Step-by-Step Guide

How to Create Custom Taxonomies with ACF Plugin 2

Taxonomies play a crucial role in organizing and categorizing the content on your website. Luckily, with the ACF plugin, you have the ability to create and assign custom taxonomies to any post type. In this blog post, we will walk you through the process of creating a custom taxonomy in ACF, assigning a custom field group to it, and importing values for your taxonomy.

The Importance of Custom Taxonomies

Before we dive into the steps for creating custom taxonomies with the ACF plugin, let’s take a moment to understand why custom taxonomies are valuable for your website. While WordPress offers built-in taxonomies like categories and tags, these might not always align with your specific requirements.

In such cases, custom taxonomies allow you to classify your content in a way that better suits your needs. They provide a structured organizational system and offer flexibility in categorizing your content based on your unique requirements.

How to Create Custom Taxonomies

To begin creating custom taxonomies with ACF, make sure you have the plugin installed on your website. Once installed, you will see the ACF menu listed in the sidebar. Follow the steps below to get started:

  1. Navigate to ACF >> Taxonomies and click on “Add New.” This will take you to the “Add New Taxonomy” page.
  2. Fill in the required fields to configure the basic settings. Provide the plural label, singular label, and taxonomy key. The taxonomy key field is automatically generated based on the singular label, but you can edit it if desired.
  3. From the “Post Types” field, select the post types to which you want to assign this custom taxonomy. You can choose multiple post types.
  4. By default, the taxonomy will be visible on the front end. If you want the taxonomy to have hierarchical descendants, enable the “Hierarchical” toggle button.

Additional Settings Configuration

ACF simplifies the configuration process with additional settings that you can access by toggling the bar. Here’s a brief overview of the available tabs:

General: Enable the “Sort Terms” option to sort the taxonomy terms. If you have the default term enabled, provide the term name (mandatory), term slug, and term description. You can also provide a general description of the taxonomy. The “Active” toggle is enabled by default, but you can deactivate the taxonomy without deleting it.

Labels: Define the labels for the taxonomy, which will be used throughout the admin dashboard. The labels are automatically generated based on the singular and plural labels you configured in the basic settings, but you can edit them if necessary.

Visibility: Control the visibility of the taxonomies on the front and admin dashboards.

URLs, permissions, and REST API: These settings are preconfigured, but you can make changes based on your specific needs. For more detailed information, refer to the ACF official documentation on custom taxonomy.

Once you have configured the settings, click “Save Changes” to save the custom taxonomy in ACF.

Adding Values to Custom Taxonomies

There are multiple ways to add values to a custom taxonomy. One option is to visit the “Add New” or “Edit” page of any record in the post type to which you assigned the custom taxonomy. You will find the custom taxonomy listed as a submenu below the post type’s sub-menus. For instance, if you assigned “CTax1” to the “Posts” post type, you will find a “Ctax1” submenu listed below the “Posts” sub-menus. From there, you can create custom taxonomies.

Assigning Custom Fields to Custom Taxonomies

You can also assign a custom field group to your custom taxonomy. To do this, follow these steps:

  1. Go to ACF >> Field Groups and click on “Add New.”
  2. Provide a title for your field group.
  3. Add field types by selecting them from the drop-down menu. Enter the field label, field name, and default value.
  4. In the “Settings” section, choose “Taxonomy” >> “is equal to” >> “your_taxonomy” from the drop-down menus.
  5. Click “Save Changes.”

Now, the custom fields you created will be assigned to your custom taxonomy, enhancing the flexibility and functionality of your website.

Conclusion

Creating custom taxonomies with the ACF plugin allows you to organise and categorise your website’s content according to your specific needs. By following the steps outlined in this guide, you can create custom taxonomies, assign field groups, and import values, providing a structured and efficient content management system for your WordPress site. Additionally, if you want to import and export ACF Custom Taxonomy values, check out the CSV importer plugin here.