Add `'widget_nav_menu_args'` filter for Custom Menu widget arguments.

props cyman, DrewAPicture.
fixes #29463.

git-svn-id: https://develop.svn.wordpress.org/trunk@31325 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-02-03 02:55:21 +00:00
parent 5e9b89bf59
commit 4aada86274
1 changed files with 20 additions and 1 deletions

View File

@ -1344,7 +1344,26 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
if ( !empty($instance['title']) )
echo $args['before_title'] . $instance['title'] . $args['after_title'];
wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) );
$nav_menu_args = array(
'fallback_cb' => '',
'menu' => $nav_menu
);
/**
* Filter the arguments for the Custom Menu widget.
*
* @since 4.2.0
*
* @param array $nav_menu_args {
* An array of arguments passed to wp_nav_menu() to retrieve a custom menu.
*
* @type callback|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
* @type mixed $menu Menu ID, slug, or name.
* }
* @param stdClass $nav_menu Nav menu object for the current menu.
* @param array $args Display arguments for the current widget.
*/
wp_nav_menu( apply_filters( 'widget_nav_menu_args', $nav_menu_args, $nav_menu, $args ) );
echo $args['after_widget'];
}