From b19e242aa55bfbf02795fad4a096f5d51a085f53 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 31 May 2010 14:54:50 +0000 Subject: [PATCH] Remove vestigial 'context' code for wp_nav_menu. This was used when we used to use the same function as a theme template tag and admin template function (now we don't.) fixes #13656. git-svn-id: https://develop.svn.wordpress.org/trunk@15075 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-ajax.php | 1 - wp-includes/nav-menu-template.php | 16 ++++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 653eab7c58..b604579c5c 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -833,7 +833,6 @@ case 'add-menu-item' : $args = array( 'after' => '', 'before' => '', - 'context' => 'backend', 'link_after' => '', 'link_before' => '', 'walker' => new Walker_Nav_Menu_Edit, diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index 429f5db561..9c1847f9f4 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -198,7 +198,6 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { * echo - Whether to echo the menu or return it. Defaults to echo. * depth - how many levels of the hierarchy are to be included. 0 means all. Defaults to 0. * walker - allows a custom walker to be specified. - * context - the context the menu is used in. * theme_location - the location in the theme to be used. Must be registered with register_nav_menu() in order to be selectable by the user. * * @since 3.0.0 @@ -209,7 +208,7 @@ function wp_nav_menu( $args = array() ) { global $_wp_nav_menu_slugs; $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', - 'depth' => 0, 'walker' => '', 'context' => 'frontend', 'theme_location' => '' ); + 'depth' => 0, 'walker' => '', 'theme_location' => '' ); $args = wp_parse_args( $args, $defaults ); $args = apply_filters( 'wp_nav_menu_args', $args ); @@ -237,12 +236,10 @@ function wp_nav_menu( $args = array() ) { if ( $menu && ! is_wp_error($menu) && !isset($menu_items) ) $menu_items = wp_get_nav_menu_items( $menu->term_id ); - // If no menu was found or if the menu has no items, call the fallback_cb - if ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) ) ) { - if ( 'frontend' == $args->context && ( function_exists($args->fallback_cb) || is_callable( $args->fallback_cb ) ) ) { + // If no menu was found or if the menu has no items, call the fallback_cb if it exists + if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) ) ) + && ( function_exists($args->fallback_cb) || is_callable( $args->fallback_cb ) ) ) return call_user_func( $args->fallback_cb, (array) $args ); - } - } // If no fallback function was specified and the menu doesn't exists, bail. if ( !$menu || is_wp_error($menu) ) @@ -258,8 +255,7 @@ function wp_nav_menu( $args = array() ) { } // Set up the $menu_item variables - if ( 'frontend' == $args->context ) - _wp_menu_item_classes_by_context( $menu_items ); + _wp_menu_item_classes_by_context( $menu_items ); $sorted_menu_items = array(); foreach ( (array) $menu_items as $key => $menu_item ) @@ -309,7 +305,7 @@ function wp_nav_menu( $args = array() ) { } /** - * Add the class property classes for the current frontend context, if applicable. + * Add the class property classes for the current context, if applicable. * * @access private * @since 3.0