Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Coding standards
  • Loading branch information
joedolson committed Oct 16, 2025
commit 452d8a4efd5131925c97af540a64e196e94d2323
23 changes: 14 additions & 9 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@
* to search only in post_title column for a better UX
*/
function wp_ajax_nopriv_menu_quick_search( $args ) {
if ( isset( $_POST['action'] ) && $_POST['action'] === 'menu-quick-search' ) {
add_filter( 'posts_search', function ( $search, $query ) {
global $wpdb;

if ( ! empty( $search ) && isset( $query->query_vars['s'] ) ) {
$search = $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s ", '%' . $wpdb->esc_like( $query->query_vars['s'] ) . '%' );
}
if ( isset( $_POST['action'] ) && 'menu-quick-search' === $_POST['action'] ) {
add_filter(
'posts_search',
function( $search, $query ) {

Check failure on line 24 in src/wp-admin/includes/ajax-actions.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Expected 1 space after FUNCTION keyword; 0 found
global $wpdb;

if ( ! empty( $search ) && isset( $query->query_vars['s'] ) ) {
$search = $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s ", '%' . $wpdb->esc_like( $query->query_vars['s'] ) . '%' );
}

return $search;
}, 10, 2 );
return $search;
},
10,
2
);
}

return $args;
Expand Down
Loading