[wp-trac] [WordPress Trac] #37975: Duplicate tag names aren't supported

WordPress Trac noreply at wordpress.org
Mon Sep 12 16:45:32 UTC 2016


#37975: Duplicate tag names aren't supported
--------------------------+------------------------------
 Reporter:  ivankk        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration
--------------------------+------------------------------

Comment (by ivankk):

 @boonebgorges thanks ;)

 Focusing on just tag slug name alone won't work, as there could be
 scenarios where your differentiating attribute is something else, e.g.
 description or some custom term meta.

 I've linked to a gist we used for solving this problem for the description
 use case. It uses get_terms + get_terms_args filters to  modify the value
 of the select2v4 dropdown in the ajax-tag-search action with a hidden ID
 in the select2v4 field, since all html is rendered anyway.

 Combined with a pre_post_tax_input filter, we can use the ID for setting
 the tags for a post.

 Relevant gist:
 https://gist.github.com/ivankruchkoff/43493f327ca60a7b1bcbae51f8b9d076

 With the above in mind, the generalised solution is that we need to:
 1. Create a filter to add arbitrary term data (description, slug, meta
 etc) to the ajax action /admin-ajax.php?action=ajax-tag-
 search&tax=post_tag It should also always return the ID but not display
 it.
 2. Change the behaviour of the tag dropdown to contain a tag ID but not
 display it.
 3. Create a filter to change the behaviour for the tagchecklist, after a
 tag is added (so that we can customise what is displayed there, e.g.
 ID:Tag Name, Tag Name-Slug...
 4. Change the  post_tag save behaviour to always expect a tag ID and
 always save based on tag ID.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37975#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list