WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#30419 closed defect (bug) (duplicate)

Taxonomy tags with '&' in name and modified slug are not assignable anymore.

Reported by: pavelic Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Taxonomy Keywords:
Focuses: Cc:
PR Number:

Description

Steps to reproduce:

  • Start with a clean WP install.
  • Go to Posts -> Tags
  • Create a tag with & in name. Example: "Test & test"
  • Edit the newly created tags slug. Default: "test-test" Replacement: "test-and-test"
  • Go to the default "Hello world post"
  • go to tags, type in "Test" until you get the dropdown option, select it, press add and press update on post
  • refresh page just in case and marvel at the lack of the tag being assigned to the post.

From what i could trace, the failing spot is the SQL query in wp-includes\taxonomy.php, term_exists().

Where the query looks something like:

SELECT tt.term_id, tt.term_taxonomy_id
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id
WHERE t.name = 'Test & test' AND tt.taxonomy = 'post_tag'

While the value actually stored in the "name" field in the wp_terms table is "Test & test".

Also, if its not obvious, it does not trigger on unchanged slug, because if the slug is unchanged it matches first on the one generated from WP.

Poke me for extra info if required.

Change History (4)

#1 follow-up: @helen
5 years ago

  • Keywords reporter-feedback added

You say "anymore" - when did this work, and when did it stop working?

#2 in reply to: ↑ 1 @pavelic
5 years ago

  • Keywords reporter-feedback removed

Replying to helen:

You say "anymore" - when did this work, and when did it stop working?

My bad, i meant in relation to the normal tags. Just try what i described and you will see the same behavior.

If the slug is not modified, then the tag assignment works. If it is modified however, it (the tag) is no longer assignable, for as long as the & is in the tag name.

At first i thought it was my custom taxonomy/custom post type fun that caused it, but then i took a fresh download and installed completely clean WP and reproduced the issue.

#3 @fuchsws
5 years ago

Will this be fixed anytime soon? I can repeat this issue too!

#4 @boonebgorges
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This should be fixed by the changes in [32353]. See #32248.

Note: See TracTickets for help on using tickets.