You can install the Query Monitor plugin to see what actual query that is being executed when you perform a search.
I suspect the problem you are having is that you are not unsetting the initial query vars. You are adding the meta query, but you haven’t removed the s= parameter, which only searches for your keyword in the title, content and excerpt.
Below $query->set('meta_query', $meta_query);
, try adding either of these: $query->set('s', '');
to set ‘s’ to an empty string or $query->__unset('s');
to unset it.
Related Posts:
- How can I change the admin search posts fields?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Custom post type admin search
- No results searching custom post type in admin panel
- How to create a custom search for custom post type?
- Extending the search context in the admin list post screen
- Include custom taxonomy term in search
- Advanced search form with filters for custom taxonomies and custom fields
- Load a script just to custom post type in admin
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Loading External Scripts in Admin but ONLY for a Specific Post Type?
- Customize Edit Post screen for Custom Post Types?
- Creating a search form for custom fields
- Filter by custom field in custom post type on admin page
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- Searching multiple custom post types and pages
- Merge two custom post types into one admin page?
- Remove the “View” Link in Post Admin
- Multiple custom post types under one admin menu
- AJAX search on post pages by custom post type
- How to make a WP_Query search with custom post types?
- group search results by post type?
- Custom post type: Add “Edit | Quick Edit | Trash | View” links to date (if title is not shown in column)?
- Development of a WordPress Search Plugin – Best Practices
- Add “Last Edited by” column to custom post type list table
- Simple way to search custom-post types only
- Pushing a custom post type to the top of the search results
- How can I filter posts by post_parent in the admin?
- Search multiple custom fields by using meta_query
- How do I Paginate Search Results for Custom Post Types?
- Filter custom post types in admin not working
- WordPress post sorting with AJAX
- Ordering posts by custom taxonomy in admin area
- Why have my custom post type searches stopped working after changing URLs / updating WordPress?
- Using standard search function with custom post type
- Search that will look in custom field, post title and post content
- Create a dropdown with Custom Post Types as option in admin
- How to add custom columns to Custom Post Type admin screen
- How to Make an admin_notices Message That Disappears Once the User Leaves That Particular Page?
- Filter admin columns by custom post field value
- Have different search results template depending of custom post type searched
- Is it OK to move admin menu items?
- Returning search results by relevance, including Custom Post Types
- How to replicate some of Drupal Views functionality in WordPress?
- The right way to create a custom search page for complex custom post types
- Prevent reload confirmation after AJAX save
- Seperating Custom Post Search Results
- Filter by custom Field for Custom post type Admin Listing
- jQuery UI in Admin (Best Practice?)
- Admin Post Update Redirection to Posts Screen
- Exclude add_filter from the admin
- Exclude from search all custom posts which are NOT in a taxonomy term
- Exclude a term of a taxonomy with a custom post type in a search
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- Custom Post type sort order not working in the admin area
- Search everything (posts, pages, tags, cpt, meta)
- Search Custom Post Type with all meta attached?
- Custom admin columns for ALL custom post types
- How to get search results in the backend admin on a custom post type?
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- filter search result with custom post type meta key
- Custom search for custom post type, custom meta and search fields
- Include images from pages in wp search.php results in default wp search
- Separating Search Results By Post Type
- Add custom column to custom post type overview in backend
- How Do I Use WP_Query to Run This Database Query as Search Result?
- Custom Post Types: pretty search URLs and has_archive
- WordPress Admin Panel search posts with custom post meta values along with title
- Backend search; include CPT meta?
- Custom Search form not working in localhost
- Custom Search | Wrong output & question
- Limit search form to 4 custom post types only
- Group search results by post type, but hide post types with no results
- Search results ordered by custom post types are not grouped
- Unable to filter on field on edit.php page
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- Is there An Input Checkbox Option That Works like `wp_dropdown_categories()` To Use In A WP Search Form?
- Search Post Title Only [duplicate]
- How can I include meta box content when searching?
- Customize Search to only search current custom post type
- How to search from specific post type with tags?
- Include different loop templates in search query
- custom search result page
- How to add post_author column to custom post type
- Adding help information to custom post edit page
- Only Show an Author Their Custom Post Types
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Custom Post Type and taxonomies’s labels localization not working
- Change admin post thumbnail size for custom post type only
- Filters post in admin with dropdown select, custom post type
- Admin List Dynamic Heading
- How can I add a column in the wp_list_table of the admin area?
- Search tags in CPTs
- Show admin help message across custom post type parent and child posts
- How to show custom (checkbox) field value in admin post list?
- WordPress User Roles, Custom Post Types, and Admin views
- Settings page above CPT page in admin section
- Set meta_query only for specific post type
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Add theme options to custom post type admin pages [closed]