Skip to content

Commit 179e7cf

Browse files
committed
Alternate solution for 48655
1 parent c665fab commit 179e7cf

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

src/wp-admin/includes/nav-menu.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,36 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
8383
} elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z0-9_-]*\b)/', $type, $matches ) ) {
8484
if ( 'posttype' === $matches[1] && get_post_type_object( $matches[2] ) ) {
8585
$post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) );
86-
$args = array_merge(
86+
$query_args = array(
87+
'no_found_rows' => true,
88+
'update_post_meta_cache' => false,
89+
'update_post_term_cache' => false,
90+
'posts_per_page' => 10,
91+
'post_type' => $matches[2],
92+
's' => $query,
93+
'search_columns' => array( 'post_title' ),
94+
);
95+
/**
96+
* Filter the menu quick search arguments.
97+
*
98+
* @since 6.9.0
99+
*
100+
* @param array $args {
101+
* Menu quick search arguments.
102+
*
103+
* @type boolean $no_found_rows Whether to return found rows data. Default true.
104+
* @type boolean $update_post_meta_cache Whether to update post meta cache. Default false.
105+
* @type boolean $update_post_term_cache Whether to update post term cache. Default false.
106+
* @type int $posts_per_page Number of posts to return. Default 10.
107+
* @type string $post_type Type of post to return.
108+
* @type string $s Search query.
109+
* @type array $search_columns Which post table columns to query.
110+
* }
111+
*/
112+
$query_args = apply_filters( 'wp_ajax_menu_quick_search_args', $args );
113+
$args = array_merge(
87114
$args,
88-
array(
89-
'no_found_rows' => true,
90-
'update_post_meta_cache' => false,
91-
'update_post_term_cache' => false,
92-
'posts_per_page' => 10,
93-
'post_type' => $matches[2],
94-
's' => $query,
95-
)
115+
$query_args
96116
);
97117

98118
if ( isset( $post_type_obj->_default_query ) ) {

0 commit comments

Comments
 (0)