Skip to content

Commit 452d8a4

Browse files
committed
Coding standards
1 parent 3d3ca3a commit 452d8a4

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/wp-admin/includes/ajax-actions.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@
1818
* to search only in post_title column for a better UX
1919
*/
2020
function wp_ajax_nopriv_menu_quick_search( $args ) {
21-
if ( isset( $_POST['action'] ) && $_POST['action'] === 'menu-quick-search' ) {
22-
add_filter( 'posts_search', function ( $search, $query ) {
23-
global $wpdb;
24-
25-
if ( ! empty( $search ) && isset( $query->query_vars['s'] ) ) {
26-
$search = $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s ", '%' . $wpdb->esc_like( $query->query_vars['s'] ) . '%' );
27-
}
21+
if ( isset( $_POST['action'] ) && 'menu-quick-search' === $_POST['action'] ) {
22+
add_filter(
23+
'posts_search',
24+
function( $search, $query ) {
25+
global $wpdb;
26+
27+
if ( ! empty( $search ) && isset( $query->query_vars['s'] ) ) {
28+
$search = $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s ", '%' . $wpdb->esc_like( $query->query_vars['s'] ) . '%' );
29+
}
2830

29-
return $search;
30-
}, 10, 2 );
31+
return $search;
32+
},
33+
10,
34+
2
35+
);
3136
}
3237

3338
return $args;

0 commit comments

Comments
 (0)