File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 1818 * to search only in post_title column for a better UX
1919 */
2020function 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 ;
You can’t perform that action at this time.
0 commit comments