You can use the Post Management add-on to add or update posts in WordPress. When a post is added or updated you can also specify which terms a post is assigned to. It is also possible to add additional terms to a taxonomy if they don’t exist by using a select field that has the Enable Tagging setting checked.
By enabling tagging, any term not found in the options of a select field will be added as a new option and submitted with the form. If that select field is then mapped to a taxonomy, the new term will be added.
Let’s create a select field and configure it to enable tagging:
- Add a select field to your form.
- Edit the select field and In the Basic tab and check the following settings:
- Multiple
- Select2
- Enable Tagging
- Click on the Options tab and configure it as follows:
- Data Source: Terms
- Filter By Taxonony: Choose the taxonomy you want to choose terms from and add new terms to
- Click Get Data and ensure the following settings are present under Column Mapping:
- Labels: Name
- Values: ID
- Click Save & Close.
Next we need to configure the Post Management action so that the select field is mapped to the taxonomy you chose in step 3 above. You should add a Post Management action if you don’t already have one.
- Click the Actions icon at the top of the page. The Actions sidebar will open.
- Edit your Post Management action.
- Under Term Mapping choose your select field in the left column and the taxonomy you chose in step 3 above in the right column.
- Click Save & Close.
You form will now add a term if the term chosen does not already exist.