Opened 9 years ago
Last modified 3 weeks ago
#38057 reviewing enhancement
'wp_update_nav_menu' action returns inconsistent number of arguments
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Menus | Keywords: | has-patch changes-requested needs-test-info |
Focuses: | Cc: |
Description
The 'wp_update_nav_menu' action is fired in two places with a different amount of arguments.
- wp-includes/nav-menu.php
do_action( 'wp_update_nav_menu', $menu_id, $menu_data );
- wp-admin/includes/nav-menu.php
do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
The first one passes along the menu id and menu data, where the second one only returns the menu id.
Attachments (1)
Change History (20)
This ticket was mentioned in Slack in #core by helen. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
#13
@
8 years ago
- Milestone changed from 4.9 to Future Release
@keraweb I know we discussed this in person, but can you refresh my memory on why the changes to the menu data were needed? Thanks!
#14
@
8 years ago
@johnbillion Wow this is a while ago.
From what I see the attributes and array keys were inconsistent at two locations where the same action is used.
This fix makes it so that both locations where the action is used will pass the same parameters and take the same array keys while maintaining backwards compatibility with the original situation.
#16
@
4 years ago
Just found out about this defect. Was listing for the action hook with two params and got a fatal error. Luckily our QA caught this before moving to PROD. Would love to see some action on this.
#17
@
2 years ago
Found this still while investigating why two params caused a fatal error. There's another do_action( 'wp_update_nav_menu', $menu_id ) in file wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php.
This ticket was mentioned in PR #9126 on WordPress/wordpress-develop by @SirLouen.
3 weeks ago
#18
This is just a Refresh for 38057.patch
Trac ticket: https://core.trac.wordpress.org/ticket/38057
#19
@
3 weeks ago
- Keywords changes-requested needs-test-info added; needs-testing removed
This patch needs further work. As @vhiltunen has commented there is another instance of this hook here
@vhiltunen, how can you trigger such error? Can you provide some reproduction instructions?
I have refreshed the patch in case anyone would like to continue to provide a solution for this.
cc @keraweb
Fix for action parameters with backwards compatibility