Skip to content

Commit

Permalink
Editor: Limit display of tags on classic editor.
Browse files Browse the repository at this point in the history
On the classic editor, limit the search of tags and non-hierarchical taxonomies to twenty results. This in turn prevents an unbounded database query via an AJAX request.

Props pikamander2, costdev, azouamauriac, audrasjb.
Fixes #55052.



git-svn-id: https://develop.svn.wordpress.org/trunk@53089 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
peterwilsoncc committed Apr 7, 2022
1 parent 7f94f99 commit 86c6fb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/_enqueues/admin/tags-suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
$.get( window.ajaxurl, {
action: 'ajax-tag-search',
tax: taxonomy,
q: term
q: term,
number: 20
} ).always( function() {
$element.removeClass( 'ui-autocomplete-loading' ); // UI fails to remove this sometimes?
} ).done( function( data ) {
Expand Down
1 change: 1 addition & 0 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function wp_ajax_ajax_tag_search() {
'name__like' => $s,
'fields' => 'names',
'hide_empty' => false,
'number' => isset( $_GET['number'] ) ? (int) $_GET['number'] : 0,
)
);

Expand Down

0 comments on commit 86c6fb2

Please sign in to comment.