#6313 closed defect (bug) (duplicate)
When you have a custom tag slug, it will duplicate tags
Reported by: | tai | Owned by: | mtekk |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.6 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
When you have a custom tag slug that is different from the tag name, you will have duplicate tags after saving a post with the tag.
Steps to reproduce (I reproduced with trunk r 7414.):
- Make a new tag at Manage -> Tags with tag name "aaa", tag slug "bbb"
- Write a post, add a tag "aaa" and hit the save button
- Go back to Manage -> Tags, you will find two "aaa" tags
So, editing tag slugs make little sense...
Attachments (2)
Change History (30)
#1
@
17 years ago
- Milestone changed from 2.5 to 2.6
- Priority changed from high to normal
- Severity changed from critical to normal
#4
@
17 years ago
- Owner changed from anonymous to mtekk
- Status changed from new to assigned
lilyfan's code seems to not work for UTF-8 character sets, thus duplicate ticket #6545 was created. I'm looking into this.
#5
@
17 years ago
- Keywords has-patch added
Ok, so the problem was not just related to UTF-8 characters, it was a space added in between a comma by in taxonomy.php located in wp-admin/includes on line 136.
Originally:
$tags_to_edit = join( ', ', $tag_names );
Changing that line to:
$tags_to_edit = join( ',', $tag_names );
seems to fix things. Was there any reason that there was a space in there? This gets rid of all custom tag slugs causing two tags being created problems.
#6
follow-up:
↓ 8
@
17 years ago
if ( $taxonomy = 'post_tag' ) {
Isn't this wrong?
if ( $taxonomy == 'post_tag' ) {
#8
in reply to:
↑ 6
@
17 years ago
A good way to prevent those kind of bug is to write
if ( 'constant' == $variable) ) {
This way PHP will complain if you forget an =.
#9
@
17 years ago
Nazgul, yeah I really should have looked through lilyfan's code more. It's fixed now, and using === as that's the appropriate comparator for this situation. I attached a new patch that has these changes, they appear to work as expected.
#11
@
17 years ago
- Milestone 2.9 deleted
So you're saying the patches won't work in 2.6 (and the problem still exists). I'll look at that this evening.
#12
@
17 years ago
- Milestone set to 2.7
Ok, in [8367] we still have this problem. The old patches do not fully fix the problem any longer. Now UTF-8 stuff just plainly fails on insert when in the write post part. Something else changed in taxonomy.php it looks like.
Can someone else verify that the old patches do not work with 2.6? Also can someone verify that UTF-8 tags do not work correctly either?
#13
@
17 years ago
yes! i'm using ZH-TW to written my blog,it's pitches works on 2.5.x but when I up to 2.6 , I try to fixed it by same way. It's not works.
and the UTF-8 Tag url works good but when I set the slug for those tag, It will duplicate again...
"Something else changed in taxonomy.php it looks like. " I think it the really! and so sad it happen again...not in the fix-list of WP 2.6.
Could mtekk help us to fixed it?
I'll keep fallow this post, if u need any test or verify, I'll give a hand!
#14
@
17 years ago
It may be a week or so before I can fully dig into this (unless I can sneak some work in on it tomorrow), if one of the developers wants to pick this up go ahead, the wp-admin-includes-taxonomy.diff patch should still be applied, but wp-includes-taxonomy.diff needs to be expanded upon.
If I insert a UTF-8 character into the Tags field in the Edit Post form, it seems to not like saving it. Which is back to square one again.
#15
follow-up:
↓ 17
@
17 years ago
Possibly related to #6867. Trying applying the patches here on top of the new taxonomy.php file linked there.
#16
@
17 years ago
- Milestone 2.7 deleted
- Resolution set to duplicate
- Status changed from assigned to closed
#6593 has some fresh patches to try. I'm going to mark this ticket as a duplicate of that and do the bug fixing over there.
#19
in reply to:
↑ 18
;
follow-up:
↓ 21
@
17 years ago
Replying to ryan:
I know #6867 doesn't fix this ticket. It probably will fix the problem mtekk described in comments 12 and 13, which is a separate issue that compounds the problem described here. Regardless, #6593 has the latest patch to try. You'll need the latest from the 2.6 branch to use it though.
I' m now using stupid way to fixed it.
that is create one Chinese tag with English slug and when I edit post, use "slug" to add tag...it's would works ok for me temporarily.
hope and waiting for really fixed file...
#20
@
17 years ago
may I ask is there possible way to make that when I edit a post ,and the tag select view as slug. show slug now show tag?
#21
in reply to:
↑ 19
@
17 years ago
Replying to rocavence:
Replying to ryan:
I know #6867 doesn't fix this ticket. It probably will fix the problem mtekk described in comments 12 and 13, which is a separate issue that compounds the problem described here. Regardless, #6593 has the latest patch to try. You'll need the latest from the 2.6 branch to use it though.
I' m now using stupid way to fixed it.
that is create one Chinese tag with English slug and when I edit post, use "slug" to add tag...it's would works ok for me temporarily.
hope and waiting for really fixed file...
Newly test... I using this stupid way and close AutoSave, It still duplicate =.=
#22
@
17 years ago
- Priority changed from normal to high
When this bug fixed?
No patch, update wordpress!
Thanks!
#23
@
16 years ago
- Priority changed from high to highest omg bbq
- Resolution duplicate deleted
- Status changed from closed to reopened
WordPress help us, please!
#24
@
16 years ago
- Priority changed from highest omg bbq to normal
- Resolution set to duplicate
- Status changed from reopened to closed
#25
@
16 years ago
It really wasn't a duplicate, but it seems to be fixed in [8524]. I assume that both of my patches were worked around, though my wp-admin-includes-taxonomy.diff one may still be applied in my build.
This ticket was mentioned in PR #205 on WordPress/wporg-mu-plugins by dd32.
3 years ago
#28
Currently post endpoints link to a non-accessible endpoint for posts, eg:
$ curl -s https://wordpress.org/photos/wp-json/wp/v2/photos/9781 | jq ._links.author[0].href "https://wordpress.org/photos/wp-json/wp/v2/users/14322318" $curl -s https://wordpress.org/photos/wp-json/wp/v2/users/14322318 | jq .message "Invalid user ID."
After this change:
$ curl -s https://wordpress.org/photos/wp-json/wp/v2/photos/9781 | jq ._links.author[0].href "https://wordpress.org/photos/wp-json/wporg/v1/users/femkreations" $ curl -s https://wordpress.org/photos/wp-json/wporg/v1/users/femkreations | jq .name "Femy Praseeth"
I think the root cause is that is_term() (at wp-includes/taxonomy.php: line around 746) only sees tag slug.
Original Code:
if is_term() recognize tag name as below, this issue will be resolved.
Patch:
ex)
1) Make a tag name "abcde" with slug "aaa".
2) Write a post, and add "abcde" tag
3) is_term() wil pickup "abcde" tag!!