Home Forums Front-end Issues Tag field with auto-creation of new tags Reply To: Tag field with auto-creation of new tags

  • If this was a must have item for one of my clients, what I would do is use some type of ACF field. This could be a multi-select field that you’re using. I would more than likely leave it as it is so for those that want to take the time to use it they can.

    Then I would create another field. I would use a text field or maybe a textarea. I would name it something like “Add Hobbies” Instructions “Don’t see the hobbies your looking for? Add New Ones” or something like that. In this field they could enter either a comma separated list or alternately a list with each item on a new line if using a text area.

    Then I would create an ACF save post filter

    In this filter I would see if the user entered anything in this field. If they did I would parse the value of the field to get a list of new tags. I would double check this list to make sure the tags did not already exist.

    Then for the ones I would create them

    Then I would append these terms to the post using with $append set to true.

    Finally I would delete the value of this new field.

    It’s a bit of work on your end, but I think it would achieve the results you’re looking for.

    Alternately you can eliminate the field your using and just use a text field and do what I suggest. Hoever, this would be more prone to errors with people adding alternate spellings of existing tags.