Opened 10 years ago
Closed 10 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: |
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)
#2
in reply to:
↑ 1
@
10 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.
You say "anymore" - when did this work, and when did it stop working?