diff --git src/wp-admin/includes/admin-filters.php src/wp-admin/includes/admin-filters.php
index 141e8aa..e318a7a 100644
|
|
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async |
119 | 119 | add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 ); |
120 | 120 | add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 ); |
121 | 121 | add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 ); |
| 122 | |
diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index 20ef07e..748d2f1 100644
|
|
function wp_ajax_fetch_list() { |
101 | 101 | /** |
102 | 102 | * Ajax handler for tag search. |
103 | 103 | * |
| 104 | * @deprecated 4.8.0 Use the REST API tags endpoint instead. |
| 105 | * |
104 | 106 | * @since 3.1.0 |
105 | 107 | */ |
106 | 108 | function wp_ajax_ajax_tag_search() { |
diff --git src/wp-admin/js/tags-suggest.js src/wp-admin/js/tags-suggest.js
index a678bdc..5613af2 100644
|
|
|
53 | 53 | |
54 | 54 | term = getLast( request.term ); |
55 | 55 | |
56 | | $.get( window.ajaxurl, { |
57 | | action: 'ajax-tag-search', |
58 | | tax: taxonomy, |
59 | | q: term |
| 56 | $.get( window.tagsSuggestL10n.rest_url, { |
| 57 | taxonomy: taxonomy, |
| 58 | search: term, |
| 59 | 'action': 'wp-post-tag-search' |
60 | 60 | } ).always( function() { |
61 | 61 | $element.removeClass( 'ui-autocomplete-loading' ); // UI fails to remove this sometimes? |
62 | 62 | } ).done( function( data ) { |
63 | | var tagName; |
64 | | var tags = []; |
65 | | |
66 | | if ( data ) { |
67 | | data = data.split( '\n' ); |
68 | | |
69 | | for ( tagName in data ) { |
70 | | var id = ++tempID; |
71 | | |
72 | | tags.push({ |
73 | | id: id, |
74 | | name: data[tagName] |
75 | | }); |
76 | | } |
77 | | |
78 | | cache = tags; |
79 | | response( tags ); |
80 | | } else { |
81 | | response( tags ); |
82 | | } |
| 63 | cache = data; |
| 64 | response( data ); |
83 | 65 | } ); |
84 | 66 | |
85 | 67 | last = request.term; |
… |
… |
|
118 | 100 | close: function() { |
119 | 101 | $element.attr( 'aria-expanded', 'false' ); |
120 | 102 | }, |
121 | | minLength: 2, |
| 103 | minLength: window.tagsSuggestL10n.minChars, |
122 | 104 | position: { |
123 | 105 | my: 'left top+2' |
124 | 106 | }, |
diff --git src/wp-includes/post.php src/wp-includes/post.php
index a33236c..afa8af0 100644
|
|
function _filter_query_attachment_filenames( $clauses ) { |
6219 | 6219 | |
6220 | 6220 | return $clauses; |
6221 | 6221 | } |
| 6222 | |
| 6223 | /** |
| 6224 | * Filter fields returned for the post edit tag search. |
| 6225 | * |
| 6226 | * @param WP_REST_Response $response The response object. |
| 6227 | * |
| 6228 | * @return WP_REST_Response $response The filtered response object. |
| 6229 | */ |
| 6230 | function wp_filter_tag_search_in_post_edit( $response ) { |
| 6231 | return array( |
| 6232 | 'id'=> $response->data['id'], |
| 6233 | 'name'=> $response->data['name'], |
| 6234 | ); |
| 6235 | } |
diff --git src/wp-includes/rest-api.php src/wp-includes/rest-api.php
index e6cdc3a..2b51fe5 100644
|
|
function rest_api_default_filters() { |
172 | 172 | add_filter( 'rest_post_dispatch', 'rest_send_allow_header', 10, 3 ); |
173 | 173 | |
174 | 174 | add_filter( 'rest_pre_dispatch', 'rest_handle_options_request', 10, 3 ); |
| 175 | |
| 176 | // Post tag search filter. |
| 177 | if ( isset( $_GET['action'] ) && 'wp-post-tag-search' === $_GET['action'] ) { |
| 178 | add_filter( 'rest_prepare_post_tag', 'wp_filter_tag_search_in_post_edit' ); |
| 179 | } |
175 | 180 | } |
176 | 181 | |
177 | 182 | /** |
diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
index b2e24d6..e01135d 100644
|
|
function wp_default_scripts( &$scripts ) { |
547 | 547 | 'termSelected' => __( 'Term selected.' ), |
548 | 548 | 'termAdded' => __( 'Term added.' ), |
549 | 549 | 'termRemoved' => __( 'Term removed.' ), |
| 550 | 'rest_url' => rest_url( '/wp/v2/tags' ), |
| 551 | /** |
| 552 | * Filters the minimum number of characters required to fire a tag search via Ajax. |
| 553 | * |
| 554 | * @since 4.0.0 |
| 555 | * |
| 556 | * @param int $characters The minimum number of characters required. Default 2. |
| 557 | */ |
| 558 | 'minChars' => (int) apply_filters( 'term_search_min_chars', 2 ), |
550 | 559 | ) ); |
551 | 560 | |
552 | 561 | $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 ); |