Opened 9 years ago
Closed 6 years ago
#1085 closed defect (bug) (fixed)
Duplicate results in developer.wordpress.org search
Reported by: | SergeyBiryukov | Owned by: | coffee2code |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Developer Hub | Keywords: | |
Cc: |
Description
Go to developer.wordpress.org and search for add_attachment
hook:
https://developer.wordpress.org/?s=add_attachment
You'll get 5 duplicate results for a single hook:
- https://developer.wordpress.org/reference/hooks/add_attachment-5/
- https://developer.wordpress.org/reference/hooks/add_attachment/
- https://developer.wordpress.org/reference/hooks/add_attachment-4/
- https://developer.wordpress.org/reference/hooks/add_attachment-3/
- https://developer.wordpress.org/reference/hooks/add_attachment-2/
Change History (19)
#2
follow-up:
↓ 5
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
There's tons. :)
add_signup_meta, admin_body_class, admin_enqueue_scripts, admin_footer, admin_head, admin_head-{$hook_suffix}, admin_memory_limit, admin_print_footer_scripts, admin_print_scripts, admin_print_scripts-{$hook_suffix}, admin_print_styles, admin_print_styles-{$hook_suffix}, archive_blog, attachment_fields_to_edit, attachment_fields_to_save, auth_cookie_expiration, autocomplete_users_for_site_admins...
And that's just going through the As in hooks. There's probably lots more classes, functions, and methods too.
#4
@
9 years ago
OK, I think I got all of the duplicate hooks. Probably wouldn't hurt to re-parse to pick up any missing descriptions. @coffee2code: What do you think?
#5
in reply to:
↑ 2
@
9 years ago
Replying to samuelsidler:
There's probably lots more classes, functions, and methods too.
There shouldn't be duplicates of anything else by their very nature. The change only affected hooks.
#6
@
9 years ago
- Resolution set to fixed
- Status changed from reopened to closed
@DrewAPicture: Your cleanup was pretty thorough. I double-checked and there was only 1 additional duplicate that needed removing.
I went ahead and re-parsed so everything should be up-to-date for 4.2.2.
#7
follow-up:
↓ 8
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
A search for add_attachment
hook now redirects to this URL:
https://developer.wordpress.org/reference/hooks/add_attachment-2/
Can we get rid of that -2
? Didn't check other hooks.
#8
in reply to:
↑ 7
@
9 years ago
Replying to SergeyBiryukov:
A search for
add_attachment
hook now redirects to this URL:
https://developer.wordpress.org/reference/hooks/add_attachment-2/
Can we get rid of that
-2
? Didn't check other hooks.
Looks like the slug for the sole entry for that hook got updated to -2. I changed it back, but I kind of wonder if there are others. Probably happened during re-parsing, /cc @coffee2code.
#9
@
9 years ago
@DrewAPicture: That specific one was sort of an oversight on my part, or at least I knew about it. The add_attachment
hook still seemed duped after the parsing. The one without the '-2' in the slug referenced a different (likely older) line number in the file, but otherwise seemed to be the same thing. So I deleted the 'add_attachement' one and forgot to change the slug for 'add_attachment-2' to drop the '-2'.
That said, I do believe there is some sort of other issue related to duplicate hooks which I don't think was due to the explicit hook duplication issue that we turned off and you just cleaned up.
Take for instance edit_terms
: https://developer.wordpress.org/?s=edit_terms
There are 4 instances of the hook, and they were all created based on the original primary hook docs (and not the "This action is documented in...). Based on the post creation times, they each correspond to a parsing run. So for some reason, this particular hook (and a handful of others like it) gets recreated each parsing (and it doesn't appear to be a signature change, which we know could cause this sort of thing).
There are the possibly affected hooks (basically any that have a version with the "-2" slug):
add_attachment-2, comments_clauses-2, comments_number-2, edit_attachment-2, edit_terms-2, editable_slug-2, edited_terms-2, export_wp-2, get_avatar_comment_types-2, hook-2, icon_dir-2, image_memory_limit-2, install_themes_tabs-2, jpeg_quality-2, link_category-2, nav_menu_meta_box_object-2, pre_get_comments-2, pre_user_login-2, register-2, session_token_manager-2, submitlink_box-2, the_comments-2, the_meta_key-2, the_permalink-2, the_post-2, the_title-2, upload_per_page-2, wp_edit_nav_menu_walker-2, wp_editor_set_quality-2, wp_handle_upload-2, wp_image_editors-2, wp_insert_attachment_data-2, wp_set_comment_status-2
Oh, and yet another issue. Take the_title
for example: https://developer.wordpress.org/?s=the_title&post_type=wp-parser-hook. There are a ton of duplicate hooks because there are multiple instances of it in deprecated.php, and since that file isn't maintained to denote that the hooks are duplicates, they look new and unique to the parser.
#11
@
9 years ago
There are a few duplicated entries:
SELECT SUBSTRING_INDEX( `post_name`, '-', 1 ) as hook, COUNT(*) AS count, GROUP_CONCAT(id) AS post_ids FROM `wporg_33_posts` WHERE `post_status` = 'publish' AND `post_type` = 'wp-parser-hook' AND `post_name` REGEXP '-[0-9]+$' GROUP BY hook ORDER BY count DESC, hook ASC;
Hook | Count | Post IDs |
---|---|---|
link_category | 14 | 7724,17939,12086,17744,5680,6070,19088,19319,17990,17136,18093,15349,13016,3082 |
pre_user_login | 11 | 12104,6088,17137,18096,17940,19089,17991,17745,4076,15361,19322 |
comments_number | 10 | 18765,9703,19130,17175,14313,16742,18011,17977,17765,19986 |
edit_attachment | 10 | 16089,17998,17754,8168,18497,17953,19687,17156,19120,13278 |
the_title | 10 | 7796,7715,13053,13051,7802,7716,3165,3048,3050,3171 |
wp_handle_upload | 10 | 17994,6478,15505,17945,17148,19374,18165,12400,19097,17750 |
wp_insert_attachment_data | 10 | 19119,17997,16088,17155,17753,8165,17952,13277,18496,19686 |
editable_slug | 9 | 12150,18116,17746,17992,19090,17138,17941,19330,15396 |
the_post | 9 | 14645,19131,17176,20076,18023,17985,18981,16938,17766 |
comments_clauses | 8 | 18529,18004,19772,17957,17759,16212,19123,17164 |
export_wp | 8 | 17149,17751,19111,17950,19495,18350,17995,15680 |
get_avatar_comment_types | 8 | 19702,17756,17160,18002,17955,19121,18516,16165 |
pre_get_comments | 8 | 17956,18528,19768,16211,19122,18003,17758,17163 |
the_comments | 8 | 19124,19770,16213,18530,17958,17165,17760,18005 |
the_meta_key | 8 | 19118,15975,17996,17752,19593,17951,17150,18447 |
upload_per_page | 8 | 19365,17944,18162,15488,17146,19096,17993,17749 |
wp_image_editors | 8 | 17976,17762,18705,18010,19128,19949,17169,16577 |
submitlink_box | 5 | 4383,17140,15440,6294,12273 |
wp_set_comment_status | 5 | 17162,158,13469,16198,8459 |
install_themes_tabs | 4 | 15414,6175,17139,12183 |
edited_terms | 3 | 16704,14224,17171 |
edit_terms | 3 | 17170,16703,14223 |
icon_dir | 3 | 3131,13034,7762 |
language_attributes | 3 | 19129,18726,19965 |
manage_link_custom_column | 3 | 19110,18339,19491 |
manage_media_custom_column | 3 | 19383,18176,19098 |
manage_pages_custom_column | 3 | 19113,18387,19524 |
manage_post | 3 | 19115,18389,19526 |
manage_posts_custom_column | 3 | 19525,19114,18388 |
manage_sites_action_links | 3 | 19426,18258,19105 |
manage_sites_custom_column | 3 | 18255,19423,19104 |
manage_themes_custom_column | 3 | 19109,18323,19475 |
ms_user_list_site_actions | 3 | 18187,19099,19395 |
ms_user_row_actions | 3 | 19399,18191,19100 |
page_row_actions | 3 | 19116,18392,19529 |
post_date_column_time | 3 | 19520,18383,19112 |
post_row_actions | 3 | 19117,19530,18393 |
tag_row_actions | 3 | 19101,19406,18214 |
taxonomy_row_actions | 3 | 19407,19102,18215 |
theme_action_links | 3 | 18318,19106,19470 |
theme_action_links_stylesheet | 3 | 19107,18319,19471 |
theme_row_meta | 3 | 19108,18321,19473 |
wpmublogsaction | 3 | 19103,18253,19421 |
image_memory_limit | 2 | 14416,13327 |
nav_menu_meta_box_object | 2 | 4435,4214 |
wp_delete_file | 2 | 17166,16416 |
add_attachment | 1 | 17755 |
add_site_option | 1 | 19551 |
add_site_option_option | 1 | 19550 |
allow_password_reset | 1 | 19796 |
comment_closed | 1 | 19714 |
comment_id_not_found | 1 | 19713 |
comment_on_draft | 1 | 19716 |
comment_on_password_protected | 1 | 19717 |
comment_on_trash | 1 | 19715 |
customize_allowed_urls | 1 | 20035 |
default_site_option_option | 1 | 19546 |
delete_site_option | 1 | 19555 |
delete_site_option_option | 1 | 19554 |
hook | 1 | 5719 |
image_size_names_choose | 1 | 13832 |
jpeg_quality | 1 | 10465 |
network_by_path_segments_count | 1 | 20129 |
preview_post_link | 1 | 19695 |
pre_add_site_option_option | 1 | 19549 |
pre_comment_on_post | 1 | 19718 |
pre_delete_site_option_option | 1 | 19553 |
pre_get_network_by_path | 1 | 20130 |
pre_site_option_option | 1 | 19545 |
pre_update_site_option_option | 1 | 19557 |
register | 1 | 5748 |
removable_query_args | 1 | 19753 |
retreive_password | 1 | 19794 |
retrieve_password | 1 | 19795 |
retrieve_password_key | 1 | 19797 |
session_token_manager | 1 | 14931 |
site_option_option | 1 | 19547 |
subdirectory_reserved_names | 1 | 19536 |
the_author_posts_link | 1 | 19982 |
the_permalink | 1 | 6053 |
update_site_option | 1 | 19559 |
update_site_option_option | 1 | 19558 |
wp_editor_set_quality | 1 | 10464 |
wp_edit_nav_menu_walker | 1 | 4428 |
#12
@
8 years ago
Just stumbled upon this again. There are 16 duplicate results for pre_user_login:
16 results found for "pre_user_login". Showing results 1 to 16.
https://developer.wordpress.org/reference/hooks/pre_user_login/
...
https://developer.wordpress.org/reference/hooks/pre_user_login-15/
This ticket was mentioned in Slack in #docs by coffee2code. View the logs.
8 years ago
#14
@
8 years ago
- Keywords has-patch added
Added a PR to the parser repo that fixes creation of new hooks on re-parsing: https://github.com/WordPress/phpdoc-parser/pull/192
Turns out that the existing post ID query was checking slugs containing underscores vs dashes.
#16
@
7 years ago
This is happening for the hook manage_{$post->post_type}_posts_custom_column
too.
https://developer.wordpress.org/reference/hooks/manage_post-post_type_posts_custom_column/
...
https://developer.wordpress.org/reference/hooks/manage_post-post_type_posts_custom_column-8/
This ticket was mentioned in Slack in #meta-devhub by drew. View the logs.
6 years ago
#18
@
6 years ago
- Keywords has-patch removed
- Owner set to coffee2code
- Status changed from reopened to accepted
The underlying cause for most of the errant duplicates has been fixed in the parser.
What remains is querying for current duplicates and deleting the invalid duplicates. I believe there are a few valid duplicates (valid in the sense that the duplicates are legitimate or the docblocks fail to properly denote one as being a duplicate -- basically the duplication is as defined by the docs and not due to a parser bug) so some manual review of each is probably necessary. Also, it's possible that a duplicate received a submitted note, which should be reparented to the canonical item before deleting the duplicate.
#19
@
6 years ago
- Resolution set to fixed
- Status changed from accepted to closed
This was effectively fixed as of my last comment. However, as of [core44612], the final two hooks that were being duplicated (link_category
and pre_user_login
) got fixed in core. (These were duplicated solely due to how they were defined in core docs and not due to a parser bug.)
There are now no longer any duplicated hooks in the Code Reference and numerous parsings have happened without new duplications appearing.
These entries are artifacts from the re-parsing that followed the 4.1 release, looks like we just missed a few. For reference, skipping duplicate hooks as a default behavior was removed from the parser in November 2014 and that capability was re-added via a filter in March 2015.
I've removed the duplicate entries for this hook, let us know if you find any others.