From 7690d9b1aacef4d1be3d943baaba30dc7354d3d5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 3 Feb 2015 02:56:23 +0000 Subject: [PATCH] Add `'widget_nav_menu_args'` filter for Custom Menu widget arguments. props cyman, DrewAPicture. fixes #29463. Built from https://develop.svn.wordpress.org/trunk@31325 git-svn-id: http://core.svn.wordpress.org/trunk@31306 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-widgets.php | 21 ++++++++++++++++++++- wp-includes/version.php | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index b21ffa3f03..6f197a321f 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -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']; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 31ccb64c29..4f96a488ff 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31324'; +$wp_version = '4.2-alpha-31325'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.