Opened 8 years ago
Closed 6 years ago
#39576 closed defect (bug) (invalid)
Admin - Tag autocomplete not work - WP >= 4.7
Reported by: | mgermani | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7 |
Component: | Taxonomy | Keywords: | has-patch needs-testing close |
Focuses: | Cc: |
Description
For WP 4.7 >= tags suggest not work properly. Ajax search return text delimited by "\n" but split parser fails:
File: wp-admin/js/tags-suggest.js
Line: 66 to 82
if ( data ) { data = data.split( '\n' ); for ( tagName in data ) { var id = ++tempID; tags.push({ id: id, name: data[tagName] }); } cache = tags; response( tags ); } else { response( tags ); } response( tags ); }
The method data = data.split( '\n' ); generate an Array() but "for in" construct set tagName with name method besides the int index.
I have fixed this issue checking if tagName is only a number:
if ( data ) { data = data.split( '\n' ); for ( tagName in data ) { var id = ++tempID; if (!isNaN(tagName)) { tags.push({ id: id, name: data[tagName] }); } } cache = tags; response( tags ); } else { response( tags ); }
I hope this help!
Best regards.
Attachments (1)
Change History (14)
#5
@
8 years ago
I did some tests with clean Wordpress version and this bug is not present with default theme. The problem is encountered when install some custom themes like this:
- MediCenter - Responsive Medical WordPress Theme (https://themeforest.net/item/medicenter-responsive-medical-wordpress-theme/4718613)
- FlatMagazione (themeforest)
Chrome Js console report this error with this message: "Uncaught TypeError: this._each is not a function" into prototype.js?ver=1.7.1:847
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
#7
@
8 years ago
I can confirm in the latest version (4.8-alpha-39357-src) using the default Twenty Seventeen theme and a custom theme at random that tag autocomplete works as expected.
This sounds like a theme-specific issue.
#8
@
8 years ago
- Keywords close added
This sounds like a theme-specific issue.
Agreed. Plus, hard to test this with commercial themes. Until we're certain that a change in WordPress broke lots of themes and we can reproduce that easily, I'm suggesting to close this one.
This ticket was mentioned in Slack in #core by jnylen. View the logs.
8 years ago
#11
follow-up:
↓ 12
@
8 years ago
I got the same problem with 4.7.3, seems to be connected with the Geo Tag plugin (https://wordpress.org/plugins/geo-tag/)
When I deactivate that, it works again. Maybe that helps.
#12
in reply to:
↑ 11
@
8 years ago
You have tried to use the tags-suggest.js.patch to fix the problem?
Replying to pampfelimetten:
I got the same problem with 4.7.3, seems to be connected with the Geo Tag plugin (https://wordpress.org/plugins/geo-tag/)
When I deactivate that, it works again. Maybe that helps.
#13
@
6 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
I managed to reproduce this using geo-tag, but the problem in that case is that they're loading a very old jQuery autocomplete script that interferes with tags-suggest.js. This kind of interference is difficult for core to avoid - it's the responsibility of plugin authors to use libraries that don't interfere with core functionality. I think we can close, unless someone can demonstrate how this is a problem with the way that WP itself loads its tag suggestion tools.
Hey there,
Thanks for your report and welcome to WordPress Trac!
Would you mind uploading your changes in form of a patch? See https://make.wordpress.org/core/handbook/tutorials/trac/submitting-a-patch/ for details. This would make verifying these adjustments easier.