Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/nav-menu.php

    r15010 r15220  
    3939     */
    4040    function start_el(&$output, $item, $depth, $args) {
     41        global $_wp_nav_menu_max_depth;
     42        $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
     43
    4144        $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
    4245
     
    6972
    7073        if ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
     74            $classes[] = 'draft';
     75            /* translators: %s: title of menu item in draft status */
     76            $title = sprintf( __('%s (Draft)'), $item->title );
     77        } elseif ( isset( $item->post_status ) && 'pending' == $item->post_status ) {
    7178            $classes[] = 'pending';
    72             /* translators: %s: title of menu item in draft status */
     79            /* translators: %s: title of menu item in pending status */
    7380            $title = sprintf( __('%s (Pending)'), $item->title );
    7481        }
     82
     83        $title = empty( $item->label ) ? $title : $item->label;
    7584
    7685        ?>
     
    190199                <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>" />
    191200                <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" />
     201                <input class="menu-item-data-status" type="hidden" name="menu-item-status[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->post_status ); ?>" />
    192202                <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" />
    193203            </div><!-- .menu-item-settings-->
     
    195205        <?php
    196206        $output .= ob_get_clean();
     207    }
     208}
     209
     210/**
     211 * Create HTML list of nav menu input items.
     212 *
     213 * @package WordPress
     214 * @since 3.0.0
     215 * @uses Walker_Nav_Menu
     216 */
     217class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu  {
     218
     219    /**
     220     * @see Walker::start_el()
     221     * @since 3.0.0
     222     *
     223     * @param string $output Passed by reference. Used to append additional content.
     224     * @param object $item Menu item data object.
     225     * @param int $depth Depth of menu item. Used for padding.
     226     * @param int $current_page Menu item ID.
     227     * @param object $args
     228     */
     229    function start_el(&$output, $item, $depth, $args) {
     230        global $_nav_menu_placeholder;
     231
     232        $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
     233        $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
     234        $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
     235
     236        $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
     237
     238        $output .= $indent . '<li>';
     239        $output .= '<label class="menu-item-title">';
     240        $output .= '<input type="checkbox" class="menu-item-checkbox';
     241        if ( ! empty( $item->_add_to_top ) ) {
     242            $output .= ' add-to-top';
     243        }
     244        $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
     245        $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label );
     246        $output .= '</label>';
     247
     248        // Menu item hidden fields
     249        $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
     250        $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';
     251        $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />';
     252        $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />';
     253        $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';
     254        $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />';
     255        $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />';
     256        $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />';
     257        $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />';
     258        $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';
     259        $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
    197260    }
    198261}
     
    217280
    218281    if ( 'get-post-item' == $type ) {
    219         if ( get_post_type_object( $object_type ) ) {
     282        if ( post_type_exists( $object_type ) ) {
    220283            if ( isset( $request['ID'] ) ) {
    221284                $object_id = (int) $request['ID'];
     
    234297                }
    235298            }
    236         } elseif ( is_taxonomy( $object_type ) ) {
     299        } elseif ( taxonomy_exists( $object_type ) ) {
    237300            if ( isset( $request['ID'] ) ) {
    238301                $object_id = (int) $request['ID'];
     
    311374function wp_nav_menu_setup() {
    312375    // Register meta boxes
    313     if ( get_registered_nav_menus() && wp_get_nav_menus() )
     376    if ( wp_get_nav_menus() )
    314377        add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
    315378    add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
     
    385448 */
    386449function wp_nav_menu_taxonomy_meta_boxes() {
    387     $taxonomies = get_taxonomies( array( 'show_ui' => true ), 'object' );
     450    $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
    388451
    389452    if ( !$taxonomies )
     
    405468 */
    406469function wp_nav_menu_locations_meta_box() {
     470    global $nav_menu_selected_id;
     471
     472    if ( ! current_theme_supports( 'menus' ) ) {
     473        // We must only support widgets. Leave a message and bail.
     474        echo '<p class="howto">' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p>';
     475        return;
     476    }
     477
    407478    $locations = get_registered_nav_menus();
    408479    $menus = wp_get_nav_menus();
     
    418489                <span><?php echo $description; ?></span>
    419490                <select name="menu-locations[<?php echo $location; ?>]" id="locations-<?php echo $location; ?>">
    420                     <option value=""></option>
     491                    <option value="0"></option>
    421492                    <?php foreach ( $menus as $menu ) : ?>
    422493                    <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?>
     
    434505    <p class="button-controls">
    435506        <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    436         <input type="submit" class="button-primary" name="nav-menu-locations" value="<?php esc_attr_e( 'Save' ); ?>" />
     507        <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-primary" name="nav-menu-locations" value="<?php esc_attr_e( 'Save' ); ?>" />
    437508    </p>
    438509    <?php
     
    445516 */
    446517function wp_nav_menu_item_link_meta_box() {
    447     global $_nav_menu_placeholder;
     518    global $_nav_menu_placeholder, $nav_menu_selected_id;
    448519    $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
    449520
     
    483554            <span class="add-to-menu">
    484555                <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    485                 <input type="submit" class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
     556                <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
    486557            </span>
    487558        </p>
     
    500571 */
    501572function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
    502     global $_nav_menu_placeholder;
     573    global $_nav_menu_placeholder, $nav_menu_selected_id;
    503574
    504575    $post_type_name = $post_type['args']->name;
     
    577648    <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
    578649        <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
    579             <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"><?php _e('Most Recent'); ?></a></li>
    580             <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li>
    581             <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li>
     650            <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"><?php _e('Most Recent'); ?></a></li>
     651            <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li>
     652            <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li>
    582653        </ul>
    583654
     
    639710                <?php
    640711                $args['walker'] = $walker;
    641                
     712
    642713                // if we're dealing with pages, let's put a checkbox for the front page at the top of the list
    643714                if ( 'page' == $post_type_name ) {
     
    697768            <span class="add-to-menu">
    698769                <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    699                 <input type="submit" class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
     770                <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
    700771            </span>
    701772        </p>
     
    714785 */
    715786function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
     787    global $nav_menu_selected_id;
    716788    $taxonomy_name = $taxonomy['args']->name;
    717789
     
    783855    <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
    784856        <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
    785             <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li>
    786             <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li>
    787             <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li>
     857            <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li>
     858            <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li>
     859            <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li>
    788860        </ul>
    789861
     
    797869                echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args );
    798870                ?>
    799             </ul>
    800         </div><!-- /.tabs-panel -->
    801 
    802         <div class="tabs-panel <?php
    803             echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    804         ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
    805             <?php
    806             if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
    807                 $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
    808                 $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
    809             } else {
    810                 $searched = '';
    811                 $search_results = array();
    812             }
    813             ?>
    814             <p class="quick-search-wrap">
    815                 <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
    816                 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    817                 <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
    818             </p>
    819 
    820             <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
    821             <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
    822                 <?php
    823                 $args['walker'] = $walker;
    824                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
    825                 ?>
    826             <?php elseif ( is_wp_error( $search_results ) ) : ?>
    827                 <li><?php echo $search_results->get_error_message(); ?></li>
    828             <?php elseif ( ! empty( $searched ) ) : ?>
    829                 <li><?php _e('No results found.'); ?></li>
    830             <?php endif; ?>
    831871            </ul>
    832872        </div><!-- /.tabs-panel -->
     
    853893        </div><!-- /.tabs-panel -->
    854894
     895        <div class="tabs-panel <?php
     896            echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     897        ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
     898            <?php
     899            if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
     900                $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
     901                $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
     902            } else {
     903                $searched = '';
     904                $search_results = array();
     905            }
     906            ?>
     907            <p class="quick-search-wrap">
     908                <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
     909                <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
     910                <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
     911            </p>
     912
     913            <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
     914            <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
     915                <?php
     916                $args['walker'] = $walker;
     917                echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
     918                ?>
     919            <?php elseif ( is_wp_error( $search_results ) ) : ?>
     920                <li><?php echo $search_results->get_error_message(); ?></li>
     921            <?php elseif ( ! empty( $searched ) ) : ?>
     922                <li><?php _e('No results found.'); ?></li>
     923            <?php endif; ?>
     924            </ul>
     925        </div><!-- /.tabs-panel -->
     926
    855927        <p class="button-controls">
    856928            <span class="list-controls">
     
    868940            <span class="add-to-menu">
    869941                <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    870                 <input type="submit" class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
     942                <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
    871943            </span>
    872944        </p>
     
    881953 * @since 3.0.0
    882954 *
    883  * @param int $menu_id The menu ID for which to save this item. $menu_id of 0 makes a draft, orphaned menu item.
     955 * @param int $menu_id The menu ID for which to save this item. $menu_id of 0 makes a pending, orphaned menu item.
    884956 * @param array $menu_data The unsanitized posted menu item data.
    885957 * @return array The database IDs of the items saved
     
    9511023function _wp_nav_menu_meta_box_object( $object = null ) {
    9521024    if ( isset( $object->name ) ) {
    953         // don't show media meta box
    954         if ( 'attachment' == $object->name )
    955             return false;
    9561025
    9571026        if ( 'page' == $object->name ) {
     
    10011070        $result = '<div id="menu-instructions" class="post-body-plain';
    10021071        $result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive">' : '">';
    1003         $result .= __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.');
     1072        $result .= '<p>' . __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.') . '</p>';
    10041073        $result .= '</div>';
    10051074
    10061075        if( empty($menu_items) )
    1007             return $result;
     1076            return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
    10081077
    10091078        $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
     
    10161085        $some_pending_menu_items = false;
    10171086        foreach( (array) $menu_items as $menu_item ) {
    1018             if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status )
     1087            if ( isset( $menu_item->post_status ) && 'pending' == $menu_item->post_status )
    10191088                $some_pending_menu_items = true;
    10201089        }
     
    10231092            $result .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>';
    10241093
     1094        $result .= '<ul class="menu" id="menu-to-edit"> ';
    10251095        $result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
     1096        $result .= ' </ul> ';
    10261097        return $result;
    10271098    } elseif ( is_wp_error( $menu ) ) {
     
    10511122}
    10521123
    1053 /** 
    1054  * Deletes orphaned draft menu items
     1124/**
     1125 * Deletes orphaned pending menu items
    10551126 *
    10561127 * @access private
     
    10581129 *
    10591130 */
    1060 function _wp_delete_orphaned_draft_menu_items() {
     1131function _wp_delete_orphaned_pending_menu_items() {
    10611132    global $wpdb;
    10621133    $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
    10631134
    1064     // delete orphaned draft menu items
    1065     $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
     1135    // delete orphaned pending menu items
     1136    $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'pending' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
    10661137
    10671138    foreach( (array) $menu_items_to_delete as $menu_item_id )
     
    10691140}
    10701141
    1071 add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
     1142add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_pending_menu_items');
    10721143
    10731144?>
Note: See TracChangeset for help on using the changeset viewer.