WordPress.org

Making WordPress.org

Change History (19)

#1 @DrewAPicture
4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

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.

#2 follow-up: @samuelsidler
4 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.

#3 @DrewAPicture
4 years ago

I'd better get to work.

#4 @DrewAPicture
4 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 @DrewAPicture
4 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 @coffee2code
4 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: @SergeyBiryukov
4 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 @DrewAPicture
4 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 @coffee2code
4 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.

#10 @swissspidy
4 years ago

There are a couple of duplicated entries for the the_title filter. See #wp35253

#11 @ocean90
4 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
comments_clauses 8 19123,17957,17759,18004,19772,17164,16212,18529
comments_number 8 16742,17765,9703,17175,14313,17977,18011,18765
editable_slug 8 17941,12150,17138,18116,17992,17746,15396,19090
edit_attachment 8 16089,17754,13278,8168,17998,17953,17156,18497
export_wp 8 15680,19111,19495,17995,17149,17950,18350,17751
get_avatar_comment_types 8 17160,16165,17955,18516,17756,19702,18002,19121
link_category 8 12086,6070,7724,15349,3082,13016,5680,17136
pre_get_comments 8 19768,18528,19122,17956,18003,16211,17163,17758
pre_user_login 8 17991,17137,6088,17745,12104,17940,4076,15361
the_comments 8 19124,17958,18530,17165,16213,19770,18005,17760
the_meta_key 8 18447,15975,17996,17752,19118,17150,19593,17951
the_post 8 17766,18023,18981,16938,17985,17176,14645,19131
the_title 8 7716,3050,3165,7802,7796,7715,3048,3171
upload_per_page 8 17749,17944,17146,18162,17993,15488,19096,19365
wp_handle_upload 8 17945,17994,12400,17148,17750,15505,18165,6478
wp_image_editors 8 19949,16577,17976,17169,18010,18705,17762,19128
wp_insert_attachment_data 8 17997,18496,17753,17155,8165,17952,13277,16088
submitlink_box 5 6294,12273,15440,17140,4383
wp_set_comment_status 5 17162,16198,158,8459,13469
install_themes_tabs 4 12183,6175,15414,17139
edited_terms 3 17171,14224,16704
edit_terms 3 14223,17170,16703
icon_dir 3 3131,7762,13034
language_attributes 3 18726,19965,19129
manage_link_custom_column 3 19491,18339,19110
manage_media_custom_column 3 19098,19383,18176
manage_pages_custom_column 3 19524,19113,18387
manage_post 3 19526,19115,18389
manage_posts_custom_column 3 19525,19114,18388
manage_sites_action_links 3 19105,18258,19426
manage_sites_custom_column 3 19423,19104,18255
manage_themes_custom_column 3 19475,19109,18323
ms_user_list_site_actions 3 19395,18187,19099
ms_user_row_actions 3 19399,18191,19100
page_row_actions 3 19529,19116,18392
post_date_column_time 3 18383,19520,19112
post_row_actions 3 18393,19117,19530
tag_row_actions 3 19406,18214,19101
taxonomy_row_actions 3 19102,19407,18215
theme_action_links 3 19106,19470,18318
theme_action_links_stylesheet 3 19107,18319,19471
theme_row_meta 3 18321,19473,19108
wpmublogsaction 3 18253,19103,19421
image_memory_limit 2 13327,14416
nav_menu_meta_box_object 2 4435,4214
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_delete_file 1 16416
wp_editor_set_quality 1 10464
wp_edit_nav_menu_walker 1 4428
Version 1, edited 4 years ago by ocean90 (previous) (next) (diff)

#12 @SergeyBiryukov
3 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.


3 years ago

#14 @DrewAPicture
2 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.

#15 @SergeyBiryukov
22 months ago

#3287 was marked as a duplicate.

#16 @yikesitskevin
22 months 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.


11 months ago

#18 @coffee2code
11 months 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 @coffee2code
8 months 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.

Note: See TracTickets for help on using tickets.