WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#25474 closed defect (bug) (fixed)

Hooks Docs: wp-admin/includes/nav-menu.php

Reported by: Faison Owned by: DrewAPicture
Milestone: 3.8 Priority: normal
Severity: normal Version:
Component: Inline Docs Keywords: has-patch commit
Focuses: Cc:

Description

Attached patch has docs for the filters nav_menu_meta_box_object nav_menu_items_{$post_type_named} wp_edit_nav_menu_walker

And actions: wp_update_nav_menu

Attachments (3)

25474.diff (3.2 KB) - added by Faison 5 years ago.
25474.2.diff (3.0 KB) - added by Faison 5 years ago.
The action wp_update_nav_menu is actually a duplicate hook.
25474.3.diff (3.1 KB) - added by DrewAPicture 5 years ago.
fix duplicate comment, other wording

Download all attachments as: .zip

Change History (8)

@Faison
5 years ago

@Faison
5 years ago

The action wp_update_nav_menu is actually a duplicate hook.

#1 follow-up: @Faison
5 years ago

I have a quick question: In this file, the filter nav_menu_meta_box_object occurs twice, but with different parameters, should the second occurrence be documented as //duplicate_hook instead of how I have it in my patch?

Thanks, Faison

#2 in reply to: ↑ 1 @DrewAPicture
5 years ago

Replying to Faison:

I have a quick question: In this file, the filter nav_menu_meta_box_object occurs twice, but with different parameters, should the second occurrence be documented as //duplicate_hook instead of how I have it in my patch?

Thanks, Faison

Since actions and filters can be used in multiple places, they still always accept the same things but in different contexts. So in the case of this hook, it accepts an object. It's up to the documentation to spell out what kind of objects it accepts, in this case that would be a post type or taxonomy object.

And since any later uses of the hook will be labeled //duplicate_hook it's a good idea to outline the various contexts in the main docblock. Something like:

@param object $post_type A nav menu meta box object, such as Page, Post, Category, Tag, etc. Accepts a post type or taxonomy object.`

#3 @DrewAPicture
5 years ago

  • Keywords needs-patch added; has-patch removed
  • Owner set to DrewAPicture
  • Status changed from new to reviewing

@DrewAPicture
5 years ago

fix duplicate comment, other wording

#4 @DrewAPicture
5 years ago

  • Keywords has-patch commit added; needs-patch removed
  • Milestone changed from Awaiting Review to 3.8

25474.3.diff fixes the duplicate comment format and cleans up a bunch of the language for clarity and consistency.

#5 @DrewAPicture
5 years ago

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

In 25935:

Inline documentation for hooks in wp-admin/includes/nav-menu.php.

Props Faison.
Fixes #25474.

Note: See TracTickets for help on using tickets.