Make WordPress Core

Ticket #25474: 25474.2.diff

File 25474.2.diff, 3.0 KB (added by Faison, 12 years ago)

The action wp_update_nav_menu is actually a duplicate hook.

  • trunk/wp-admin/includes/nav-menu.php

     
    498498                return;
    499499
    500500        foreach ( $post_types as $post_type ) {
     501                /**
     502                 * Filter the post types used as menu item metaboxes.
     503                 *
     504                 * If you return a falsey value instead of a post type object,
     505                 * the post type will be excluded as a menu item metabox.
     506                 *
     507                 * @since 3.0.0
     508                 *
     509                 * @param object $post_type The post type object to be used as a metabox.
     510                 */
    501511                $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
    502512                if ( $post_type ) {
    503513                        $id = $post_type->name;
     
    520530                return;
    521531
    522532        foreach ( $taxonomies as $tax ) {
     533                /**
     534                 * Filter the taxonomies used as menu item metaboxes.
     535                 *
     536                 * If you return a falsey value instead of a taxonomy object,
     537                 * the taxonomy will be excluded as a menu item metabox.
     538                 *
     539                 * @since 3.0.0
     540                 *
     541                 * @param object $tax The taxonomy object to be used as a metabox.
     542                 */
    523543                $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
    524544                if ( $tax ) {
    525545                        $id = $tax->name;
     
    775795                                        }
    776796                                }
    777797
    778                                 $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type );
     798                                /**
     799                                 * Filter the posts displayed in the View All tab of the menu item metabox for a specific post type.
     800                                 *
     801                                 * @since 3.2.0
     802                                 *
     803                                 * @param array  $posts     All of the posts for the current post type.
     804                                 * @param array  $args      An array of arguments. @see WP_QUERY::query()
     805                                 * @param object $post_type The current post type object for this menu item metabox.
     806                                 */
     807                                $posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type );
    779808                                $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
    780809
    781810                                if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
     
    11321161                if( empty($menu_items) )
    11331162                        return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
    11341163
    1135                 $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
     1164                $walker_class_name = 'Walker_Nav_Menu_Edit';
    11361165
     1166                /**
     1167                 * Filter the Walker used to render a menu formatted for editing.
     1168                 *
     1169                 * @since 3.0.0
     1170                 *
     1171                 * @param string $walker_class_name The Walker class used to render a menu formatted for editing.
     1172                 * @param int    $menu_id           The id of the menu being rendered.
     1173                 */
     1174                $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', $walker_class_name, $menu_id );
     1175
    11371176                if ( class_exists( $walker_class_name ) )
    11381177                        $walker = new $walker_class_name;
    11391178                else
     
    12761315
    12771316        wp_defer_term_counting( false );
    12781317
     1318        //duplicate_hook
    12791319        do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
    12801320
    12811321        $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%1$s</strong> has been updated.' ), $nav_menu_selected_title ) . '</p></div>';