The default WordPress search query only works on post_title and post_content fields from the wp_posts
table, not including meta stored on the wp_postmeta
table.
It really depends on what type of search you want to perform how you could solve this, for instance, “full text”-type search, require a match on a given post meta, custom ranking, etc.
I think the current good practice, and a simple solution, would be to add those kind of meta data using blocks (which would save their data on the post_content field), and also saving them as meta data (as “source of truth” or more advanced querying).
For showing the meta data, you can use get_post_meta( $post->ID, 'meta_key', true )
or echo $post->my_custom_meta_key
(WordPress would automatically show the value from the given meta key).
Related Posts:
- Simple way to search custom-post types only
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Limit search field to just search a custom post type with custom fields
- search results to show individual ACF fields from inside custom posts
- Advanced search form with multiple custom fields
- 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
- Creating a search form for custom fields
- Filter by custom field in custom post type on admin page
- Getting custom taxonomy from custom post type
- Media library – Limit images to custom post type
- Searching multiple custom post types and pages
- AJAX search on post pages by custom post type
- Filter next_post_link() and previous_post_link() by meta_key?
- How can I change the admin search posts fields?
- How to make a WP_Query search with custom post types?
- group search results by post type?
- importing third party json feed as custom post type [closed]
- Development of a WordPress Search Plugin – Best Practices
- how to get posts by custom post type then display Custom fields?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Pushing a custom post type to the top of the search results
- Search multiple custom fields by using meta_query
- How do I Paginate Search Results for Custom Post Types?
- Custom post type admin search
- WordPress post sorting with AJAX
- 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
- Filtering a WP_Query meta_query by numeric values isn’t working
- Have different search results template depending of custom post type searched
- Populate a ACF Select Dropdown from Custom Post Type
- Automatically fill custom field value on post publish/update
- 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
- Filter a custom field based on selection of another custom field (ACF) [closed]
- Seperating Custom Post Search Results
- Hiding Custom Post Type from Google?
- 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
- Make permalinks based on an ACF-field
- Search everything (posts, pages, tags, cpt, meta)
- ACF Relationships in Custom Post Type Permalink
- WP Rest API Querying Custom Posts by ACF fields
- How to sort a table of custom posts by column containing custom field
- Search Custom Post Type with all meta attached?
- filter search result with custom post type meta key
- Custom search for custom post type, custom meta and search fields
- Meta Query “IN” doesn’t work with ACF checkbox filter
- Include images from pages in wp search.php results in default wp search
- Separating Search Results By Post Type
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- How Do I Use WP_Query to Run This Database Query as Search Result?
- Custom Post Types: pretty search URLs and has_archive
- List events by month
- WordPress Admin Panel search posts with custom post meta values along with title
- Backend search; include CPT meta?
- Use Custom Post Type as Custom Field
- Custom Search form not working in localhost
- Custom Search | Wrong output & question
- Count custom post types with a specific meta value
- Limit search form to 4 custom post types only
- Query by 2 values of a repeater ACF field
- Group search results by post type, but hide post types with no results
- Search results ordered by custom post types are not grouped
- Is there An Input Checkbox Option That Works like `wp_dropdown_categories()` To Use In A WP Search Form?
- Search Post Title Only [duplicate]
- Insert slider (Custom Post Type) into pages
- get terms that have post with custom post type between 2 values
- 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?
- No results searching custom post type in admin panel
- Include different loop templates in search query
- How to set custom post type as post title to avoid ‘Auto Draft’
- custom search result page
- Pull image from ACF field in a Custom Post Type
- Archive filter disappears on no results?
- Search tags in CPTs
- Query current and future events, ordered by begin date
- Show ACF field from custom taxonomy and display on the single template
- Change message given when deleting post from custom post type
- How to search CPT’s by meta query from the admin dashboard?
- Set meta_query only for specific post type
- Display posts if a custom field value is equal to another custom field value
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Linking three taxonomies with ACF
- Customize Search Results for Custom Post Type
- multiple search forms and search results
- Get Custom Field Values by Another Custom Field in WordPress
- error in Advanced Search Form for Custom Post Types in WordPress array_key_exists() expects parameter 2to be array, string given
- WordPress custom post type archive with description
- wp_update_post based function works on existing posts, but not new posts
- How to Display ACF Relationship Custom Field as Link to Specific Custom Post?
- Show custom field from custom taxanomy term on custom post type
- Search Custom Post Type Custom Fields