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
- Include custom taxonomy term in search
- Customize Edit Post screen for Custom Post Types?
- 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
- Multiple custom post types under one admin menu
- AJAX search on post pages by custom 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
- 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?
- Filter admin columns by custom post field value
- Is it OK to move admin menu items?
- Seperating Custom Post Search Results
- Filter by custom Field for Custom post type Admin Listing
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- Search everything (posts, pages, tags, cpt, meta)
- 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
- Search Post Title Only [duplicate]
- custom search result page
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Change admin post thumbnail size for custom post type only
- Filters post in admin with dropdown select, custom post type
- Admin List Dynamic Heading
- WordPress User Roles, Custom Post Types, and Admin views
- Settings page above CPT page in admin section
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Customize Search Results for Custom Post Type
- Using WPAlchemy metabox values in another metabox
- error in Advanced Search Form for Custom Post Types in WordPress array_key_exists() expects parameter 2to be array, string given
- Search Custom Post Type Custom Fields
- How to customize admin posts based on the user who is logged in
- Set a default category – if the user didn’t select one- before creating a post
- Keyword search limited to specific post type filtered by multiple custom taxonomies?
- How can I create a custom meta box to add an mp4 video to a page?
- WooCommerce product search titles only
- Remove rows in the manage post/page view
- Access $post object when adding custom columns to list table
- custom post type Search returns No Results in admin panel
- Search Custom Post Type & Taxonomies
- Get parse_query filter to return slug instead of id
- How to stick custom post at the top in search results
- filter custom post type by meta key in dashboard
- Custom admin post.php page
- Can I search only some of the fields of a custom post type?
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Advanced search form with filters for custom taxonomies
- filter search custom field query
- Include custom taxonomy term in search
- Custom post type isn’t working
- Search one custom post type ONLY, disable “all posts”
- Add a ‘guide’ image to custom post type admin page
- Sortable column containing numeric values for Custom Post Type at WordPress Backend
- Linking to Post Types from wp-admin
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Hide custom post type from search based on custom taxonomy
- Pagination on search results page
- Best way to create a search for custom post type by custom field values
- Multi Parameter search with custom post type category and tag
- Is there a hook between clicking on “Add new” and the edit screen of a new post?
- Redirecting search to specific templates with $_GET[“post_type”]
- WordPress admin for a custom post, hide/collapse the main “title” and “description” boxes
- Search custom type post
- How to have multiple search result pages in wordpress with taxonomy terms listed
- Creating a custom WP query for a Custom Post Type
- How to hide private posts even if user is admin
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- Custom Post type doesn’t appear in search results
- search results to show individual ACF fields from inside custom posts
- post_type incorrect for custom post type
- Live search by custom tag
- how to create custom taxonomy drop downs for parents and child
- Create an administation subpage containing posts in a certain category
- WP_Query with custom post type search showing all results every time
- Extensive search filtering and results->PDF in the front-end
- Exclude categories For Custom post types
- Collection of fields in a single post
- Multiple search template with separate stylesheets
- Advanced search form with filters for custom taxonomies and custom fields
- Searching for a single custom post type, buddypress
- Customising wordpress search and using $_GET[“s”]
- How do I do this?: If custom post type exists, echo it, else do not
- WordPress search results
- Display read only info on admin, custom post page
- Drop Down Filter with CPT as Options for Search Form
- Searching Custom Posts content with JQuery
- WordPress search results grouped by post type
- Why custom search engine only searches in post titles of custom posts?
- How do I provide a search form for a specific post type, that is capable of searching within custom fields of the specified CPT?
- Admin menu link with variable
- Meta_query question