#19647 closed enhancement (fixed)
Use add_node() instead of add_menu() in core
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.4 | Priority: | low |
Severity: | normal | Version: | 3.3 |
Component: | Toolbar | Keywords: | has-patch commit |
Focuses: | Cc: |
Description (last modified by )
'It's clear through class-wp-admin-bar.php and Nacin has stated this too:
The API previously emphasized
add_menu()
, but this can be confusing, soadd_node()
is now being promoted a bit more.
Another step towards this would be that the core used add_node()
instead of add_menu()
when building menu items in admin-bar.php.
Proposed patch replaces all references to the add_menu()
method with the add_node()
one. (Also some code structure modifications for wp_admin_bar_appearance_menu()
.)
Attachments (7)
Change History (22)
#3
@
9 years ago
- Description modified (diff)
- Keywords needs-refresh added; 2nd-opinion removed
- Severity changed from minor to normal
#4
@
9 years ago
- Keywords needs-patch added; needs-refresh has-patch removed
- Priority changed from normal to low
Needs a patch minus the unnecessary formatting changes.
#7
@
8 years ago
- Keywords needs-testing added
- Milestone changed from Awaiting Review to Future Release
#8
@
5 years ago
- Keywords needs-dev-note commit added; needs-testing removed
Looks great Morgan, going to get this committed.
#10
@
5 years ago
- Keywords 2nd-opinion added; commit removed
- Milestone changed from Future Release to 5.4
- Resolution fixed deleted
- Status changed from closed to reopened
I'm not sure that this deprecated notice provides much value. Most plugins that add an admin toolbar menu are using the add_menu()
method, as was core until this changeset.
A search for >add_menu(
in the plugin directory returns over 1,200 results: https://wpdirectory.net/search/01DS0ZDS11A6JZEF4VH3SNVZAF
I'd like to propose removing the deprecated notice for this method. It might have made sense eight years ago but it now seems like an unnecessary deprecation given its widespread usage.
#12
@
5 years ago
- Keywords commit added; needs-dev-note 2nd-opinion removed
Thanks Jake! I'm going to make an executive decision and go ahead with this as per my comment above.
#14
@
5 years ago
@johnbillion when you have a chance: both add_menu()
and remove_menu()
still have a @since
notation mentioning the deprecation. Should those be removed as well?
* @since 5.4.0 Deprecated in favor of {@see WP_Admin_Bar::add_node()}. * @since 5.4.0 Deprecated in favor of {@see WP_Admin_Bar::remove_node()}.
Ryan, you game?