Changeset 37881
- Timestamp:
- 06/27/2016 11:50:31 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/nav-menu.php
r37748 r37881 71 71 } elseif ( preg_match('/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches) ) { 72 72 if ( 'posttype' == $matches[1] && get_post_type_object( $matches[2] ) ) { 73 query_posts(array( 74 'posts_per_page' => 10, 75 'post_type' => $matches[2], 76 's' => $query, 77 )); 78 if ( ! have_posts() ) 73 $search_results_query = new WP_Query( array( 74 'no_found_rows' => true, 75 'update_post_meta_cache' => false, 76 'update_post_term_cache' => false, 77 'posts_per_page' => 10, 78 'post_type' => $matches[2], 79 's' => $query, 80 ) ); 81 if ( ! $search_results_query->have_posts() ) { 79 82 return; 80 while ( have_posts() ) { 81 the_post(); 83 } 84 while ( $search_results_query->have_posts() ) { 85 $post = $search_results_query->next_post(); 82 86 if ( 'markup' == $response_format ) { 83 $var_by_ref = get_the_ID();87 $var_by_ref = $post->ID; 84 88 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args ); 85 89 } elseif ( 'json' == $response_format ) { 86 90 echo wp_json_encode( 87 91 array( 88 'ID' => get_the_ID(),89 'post_title' => get_the_title( ),90 'post_type' => get_post_type(),92 'ID' => $post->ID, 93 'post_title' => get_the_title( $post->ID ), 94 'post_type' => $matches[2], 91 95 ) 92 96 );
Note: See TracChangeset
for help on using the changeset viewer.