diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
index a6aac33053..cb53add679 100644
|
a
|
b
|
function _wp_ajax_menu_quick_search( $request = array() ) { |
| 26 | 26 | $object_type = isset( $request['object_type'] ) ? $request['object_type'] : ''; |
| 27 | 27 | $query = isset( $request['q'] ) ? $request['q'] : ''; |
| 28 | 28 | $response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json'; |
| | 29 | $hide_empty = ( isset( $_REQUEST['hide-empty'] ) && true == $_REQUEST['hide-empty'] ) ? false : true; |
| 29 | 30 | |
| 30 | 31 | if ( 'markup' == $response_format ) { |
| 31 | 32 | $args['walker'] = new Walker_Nav_Menu_Checklist; |
| … |
… |
function _wp_ajax_menu_quick_search( $request = array() ) { |
| 109 | 110 | $terms = get_terms( $matches[2], array( |
| 110 | 111 | 'name__like' => $query, |
| 111 | 112 | 'number' => 10, |
| | 113 | 'hide_empty' => $hide_empty, |
| 112 | 114 | )); |
| 113 | 115 | if ( empty( $terms ) || is_wp_error( $terms ) ) |
| 114 | 116 | return; |
| … |
… |
function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) { |
| 734 | 736 | <?php |
| 735 | 737 | if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) { |
| 736 | 738 | $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ); |
| 737 | | $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) ); |
| | 739 | $hide_empty = isset( $_REQUEST['quick-search-hide-empty-' . $taxonomy_name] ) ? false : true; |
| | 740 | $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false, 'hide_empty' => $hide_empty ) ); |
| 738 | 741 | } else { |
| 739 | 742 | $searched = ''; |
| 740 | 743 | $search_results = array(); |
| … |
… |
function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) { |
| 747 | 750 | <?php submit_button( __( 'Search' ), 'small quick-search-submit hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> |
| 748 | 751 | </p> |
| 749 | 752 | |
| | 753 | <p> |
| | 754 | <input type="checkbox" class="quick-search-hide-empty" checked="checked" name="quick-search-hide-empty-<?php echo $taxonomy_name; ?>" id="quick-search-hide-empty-<?php echo $taxonomy_name; ?>" /> |
| | 755 | <label for="quick-search-hide-empty-<?php echo $taxonomy_name; ?>"><?php printf( __( 'Include %s with no post' ), strtolower( $box['title'] ) ); ?></label> |
| | 756 | </p> |
| | 757 | |
| 750 | 758 | <ul id="<?php echo $taxonomy_name; ?>-search-checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear"> |
| 751 | 759 | <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?> |
| 752 | 760 | <?php |
diff --git a/src/wp-admin/js/nav-menu.js b/src/wp-admin/js/nav-menu.js
index bcce09a5dd..2f1eafa9ef 100644
|
a
|
b
|
var wpNavMenu; |
| 902 | 902 | }).on( 'blur', '.quick-search', function() { |
| 903 | 903 | api.lastSearch = ''; |
| 904 | 904 | }); |
| | 905 | |
| | 906 | /* |
| | 907 | * Update the quick search results when the user chooses to |
| | 908 | * hide or show the empty taxonomies |
| | 909 | */ |
| | 910 | $( '.quick-search-hide-empty' ).on( 'change', function() { |
| | 911 | var $this = $(this).closest('div').find('.quick-search').first(); |
| | 912 | |
| | 913 | api.updateQuickSearchResults( $this ); |
| | 914 | }); |
| 905 | 915 | }, |
| 906 | 916 | |
| 907 | 917 | updateQuickSearchResults : function(input) { |
| … |
… |
var wpNavMenu; |
| 926 | 936 | 'menu': $('#menu').val(), |
| 927 | 937 | 'menu-settings-column-nonce': $('#menu-settings-column-nonce').val(), |
| 928 | 938 | 'q': q, |
| 929 | | 'type': input.attr('name') |
| | 939 | 'type': input.attr('name'), |
| | 940 | 'hide-empty': input.closest('div').find('.quick-search-hide-empty').first().attr('checked') |
| 930 | 941 | }; |
| 931 | 942 | |
| 932 | 943 | $( '.spinner', panel ).addClass( 'is-active' ); |
| … |
… |
var wpNavMenu; |
| 1064 | 1075 | wrapper = target.parents('.accordion-section-content').first(); |
| 1065 | 1076 | |
| 1066 | 1077 | // upon changing tabs, we want to uncheck all checkboxes |
| 1067 | | $('input', wrapper).removeAttr('checked'); |
| | 1078 | $('input', wrapper).not('.quick-search-hide-empty').removeAttr('checked'); |
| 1068 | 1079 | |
| 1069 | 1080 | $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive'); |
| 1070 | 1081 | $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active'); |