Celebrate WordCamp Asia! - 30% OFF with coupon WC30 at checkout - Terms

Managing Taxonomy Terms with Post ManagementPRO

The Post Management add-on allows you to set WordPress taxonomy terms on posts as well as populate a form field with term values.

What is a Taxonomy?

In WordPress, a Taxonony is used to group and organize content, such as posts, pages, and custom post types. The most common built-in taxonomies are categories and tags, which help classify content in a logical structure.

What is a Term?

Within a taxonomy, there are individual Terms, which are the specific labels or names you assign to a piece of content. For example:

  • Category (Taxonomy)
    • Health (Term)
    • Technology (Term)
    • Travel (Term)

Custom taxonomies can also be created to tailor content organization to specific needs, providing flexibility for developers and site owners to build more intuitive and structured websites.

Creating a Field for Terms

The the most popular field types used for allowing a user to pick a term are:

A Hidden field containing a term ID value can also be used.

This tutorial explains how to configure a field for use with terms, how to assign terms to a post and how to populate a form field with the term(s) assigned to a post.

Configuring the Field

Demo

The example select field above is configured as follows. It is a similar configuration for checkbox and radio fields.

Basic Tab

Configure the field to use Select2. Select2 enables the user to search for terms and the multiple setting shows those terms as pills in the field.

  • Multiple: Checked
  • Select2: Checked

Learn more about Select2

Options Tab

Use the terms data source to populate the field dynamically with terms from one or more taxonomies.

  • Data Source: Terms
  • Filter By Taxonomy: Your chosen taxonomy

Learn more about Data Sources

Options Tab – Column Mapping

Set the column mapping to determine which data grid columns are used for labels, values and action variables. The action variables column mapping tells WS Form which column to use when data is pushed to the post management action. It must be set to ID.

  • Labels: Name (Shown to the user)
  • Values: ID
  • Action Variables: ID (Used for the Post)

Learn more about Column Mapping

Summary

Whichever field type you choose, you must ensure the value passed to the Post Management action is one or more Term IDs.

Adding Terms to a Post

Adding terms to a post is achieved by using the Post Management action.

To set terms on a post, first create or edit the Post Management action as follows:

  1. Click the Actions icon at the top of the layout editor.
  2. Click the settings icon next to the Post Management action. Learn how to create a Post Management action.
  3. Scroll down to the Term Mapping and Terms section.

WS Form - Post Management - Term Mapping

Term Mapping

The Term Mapping setting allows you to add a term to a particular taxonomy from a WS Form field. To add a mapping:

  1. Click the add icon below the setting.
  2. In the Form Field setting, choose the field on your form that contains term IDs.
  3. In the Taxonomy setting choose the taxonomy you want to set when the post is added or updated. This should be the taxonomy that the terms in the Form Field relate to.

Terms

It is also possible to manually select Terms to apply to the post being added or updated. To add a term:

  1. Click the add icon below the setting.
  2. Search for a term name.
  3. Click the term name to add it.

Populating a Form Field

Populating a form field with the term(s) assigned to a post is achieved by using the Populate Using Action settings.

To do this:

  1. Click the Form Settings  icon at the top of the layout editor.
  2. Click the Data tab.
  3. Ensure your Data tab is configured to populate the form from a post.
    1. Enable the Populate Using Action checkbox.
    2. Choose Post Management under Action to Populate From.
    3. Choose a Post ID to populate from. Learn how to populate a form with post data.
  4. Under Term Mapping choose any fields on your form that contain terms.

WS Form will then populate the chosen fields with terms that are assigned to the selected Post ID.