- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/nav-menu.php
r15010 r15220 39 39 */ 40 40 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 41 44 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; 42 45 … … 69 72 70 73 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 ) { 71 78 $classes[] = 'pending'; 72 /* translators: %s: title of menu item in draftstatus */79 /* translators: %s: title of menu item in pending status */ 73 80 $title = sprintf( __('%s (Pending)'), $item->title ); 74 81 } 82 83 $title = empty( $item->label ) ? $title : $item->label; 75 84 76 85 ?> … … 190 199 <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 ); ?>" /> 191 200 <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 ); ?>" /> 192 202 <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" /> 193 203 </div><!-- .menu-item-settings--> … … 195 205 <?php 196 206 $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 */ 217 class 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 ) .'" />'; 197 260 } 198 261 } … … 217 280 218 281 if ( 'get-post-item' == $type ) { 219 if ( get_post_type_object( $object_type ) ) {282 if ( post_type_exists( $object_type ) ) { 220 283 if ( isset( $request['ID'] ) ) { 221 284 $object_id = (int) $request['ID']; … … 234 297 } 235 298 } 236 } elseif ( is_taxonomy( $object_type ) ) {299 } elseif ( taxonomy_exists( $object_type ) ) { 237 300 if ( isset( $request['ID'] ) ) { 238 301 $object_id = (int) $request['ID']; … … 311 374 function wp_nav_menu_setup() { 312 375 // Register meta boxes 313 if ( get_registered_nav_menus() &&wp_get_nav_menus() )376 if ( wp_get_nav_menus() ) 314 377 add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' ); 315 378 add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); … … 385 448 */ 386 449 function 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' ); 388 451 389 452 if ( !$taxonomies ) … … 405 468 */ 406 469 function 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 “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '</p>'; 475 return; 476 } 477 407 478 $locations = get_registered_nav_menus(); 408 479 $menus = wp_get_nav_menus(); … … 418 489 <span><?php echo $description; ?></span> 419 490 <select name="menu-locations[<?php echo $location; ?>]" id="locations-<?php echo $location; ?>"> 420 <option value=" "></option>491 <option value="0"></option> 421 492 <?php foreach ( $menus as $menu ) : ?> 422 493 <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?> … … 434 505 <p class="button-controls"> 435 506 <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' ); ?>" /> 437 508 </p> 438 509 <?php … … 445 516 */ 446 517 function wp_nav_menu_item_link_meta_box() { 447 global $_nav_menu_placeholder ;518 global $_nav_menu_placeholder, $nav_menu_selected_id; 448 519 $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1; 449 520 … … 483 554 <span class="add-to-menu"> 484 555 <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" /> 486 557 </span> 487 558 </p> … … 500 571 */ 501 572 function 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; 503 574 504 575 $post_type_name = $post_type['args']->name; … … 577 648 <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv"> 578 649 <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> 582 653 </ul> 583 654 … … 639 710 <?php 640 711 $args['walker'] = $walker; 641 712 642 713 // if we're dealing with pages, let's put a checkbox for the front page at the top of the list 643 714 if ( 'page' == $post_type_name ) { … … 697 768 <span class="add-to-menu"> 698 769 <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; ?>" /> 700 771 </span> 701 772 </p> … … 714 785 */ 715 786 function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) { 787 global $nav_menu_selected_id; 716 788 $taxonomy_name = $taxonomy['args']->name; 717 789 … … 783 855 <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv"> 784 856 <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> 788 860 </ul> 789 861 … … 797 869 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args ); 798 870 ?> 799 </ul>800 </div><!-- /.tabs-panel -->801 802 <div class="tabs-panel <?php803 echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );804 ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">805 <?php806 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 <?php823 $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; ?>831 871 </ul> 832 872 </div><!-- /.tabs-panel --> … … 853 893 </div><!-- /.tabs-panel --> 854 894 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 855 927 <p class="button-controls"> 856 928 <span class="list-controls"> … … 868 940 <span class="add-to-menu"> 869 941 <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; ?>" /> 871 943 </span> 872 944 </p> … … 881 953 * @since 3.0.0 882 954 * 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. 884 956 * @param array $menu_data The unsanitized posted menu item data. 885 957 * @return array The database IDs of the items saved … … 951 1023 function _wp_nav_menu_meta_box_object( $object = null ) { 952 1024 if ( isset( $object->name ) ) { 953 // don't show media meta box954 if ( 'attachment' == $object->name )955 return false;956 1025 957 1026 if ( 'page' == $object->name ) { … … 1001 1070 $result = '<div id="menu-instructions" class="post-body-plain'; 1002 1071 $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>'; 1004 1073 $result .= '</div>'; 1005 1074 1006 1075 if( empty($menu_items) ) 1007 return $result ;1076 return $result . ' <ul class="menu" id="menu-to-edit"> </ul>'; 1008 1077 1009 1078 $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); … … 1016 1085 $some_pending_menu_items = false; 1017 1086 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 ) 1019 1088 $some_pending_menu_items = true; 1020 1089 } … … 1023 1092 $result .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>'; 1024 1093 1094 $result .= '<ul class="menu" id="menu-to-edit"> '; 1025 1095 $result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) ); 1096 $result .= ' </ul> '; 1026 1097 return $result; 1027 1098 } elseif ( is_wp_error( $menu ) ) { … … 1051 1122 } 1052 1123 1053 /** 1054 * Deletes orphaned draftmenu items1124 /** 1125 * Deletes orphaned pending menu items 1055 1126 * 1056 1127 * @access private … … 1058 1129 * 1059 1130 */ 1060 function _wp_delete_orphaned_ draft_menu_items() {1131 function _wp_delete_orphaned_pending_menu_items() { 1061 1132 global $wpdb; 1062 1133 $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS); 1063 1134 1064 // delete orphaned draftmenu items1065 $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 ) ); 1066 1137 1067 1138 foreach( (array) $menu_items_to_delete as $menu_item_id ) … … 1069 1140 } 1070 1141 1071 add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_ draft_menu_items');1142 add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_pending_menu_items'); 1072 1143 1073 1144 ?>
Note: See TracChangeset
for help on using the changeset viewer.