As of version 1.5 of USP Pro, it’s possible to set up a form that auto-creates categories if they don’t exist. This was already possible with tags, and it also works with categories. This is a great way to enable users to add their own categories and/or tags when submitting content.
Let users add new categories
To accomplish this, just replace the category shortcode with this slice of markup:
<label for="usp-category" class="usp-label usp-label-category">Post Category</label>
<input name="usp-category" type="text" value="" data-required="true" maxlength="99" placeholder="Category" class="usp-input usp-input-category">
The main difference here is that we’re using a text input field for the category. Normally the category field is displayed as a checkbox or select input. By changing it to a text input, users are able to enter their own new categories, separated by commas.
Upon form submission, WordPress checks each user category; if it exists, it will be added to the post, otherwise it will be automatically created and then added to the post.
Pro Tip
To make the category text field required, add this along with the above lines of code:
<input name="usp-category-required" value="1" type="hidden">
Let users add new tags
Even easier. Visit General Settings ▸ Tag Settings ▸ Tag Menu, and select the option to “Display tags as a text-input”. Then include the [usp_tags]
shortcode with any attributes in your form(s).
When displayed on the front-end, the tags field will be a text input that enables users to write their own tags (comma-separated). Upon form submission, WordPress checks each user tag; if it exists, it will be added to the post, otherwise it will be automatically created and then added to the post.
Let users add new taxonomy terms
With USP Pro, it also is possible to enable users to specify their own taxonomy terms. To see how it’s done, check out the tutorial on Custom Taxonomies.