With WordPress 4.2.2 I’m using the following (admittedly fragile) method to search excerpts as well as the content and title without a plugin.
This is the relevant snippet from functions.php.
add_filter('posts_where', 'custom_posts_where');
function custom_posts_where($where) {
if (is_search()) {
$where = preg_replace(
"/(\w+).post_title LIKE ('%.*?%')/",
"$1.post_title LIKE $2) OR ($1.post_excerpt LIKE $2",
$where);
}
return $where;
}
Related Posts:
- Custom Taxonomy, shows empty value (home page of website)
- Custom Search only for my Custom Taxonomy Page – data
- get_the_term_list without links in 3.1
- Using pre_get_posts to rewrite search query to display posts from multiple taxonomies
- Exclude Specific Term from Search
- WordPress database error: [Not unique table/alias: ‘wp_postmeta’]
- WordPress Search – display taxonomy terms in results
- wp_insert_term – parent & child problem
- Custom order of terms for custom taxonomy in admin and website
- How to find taxonomy name using only taxonomy TERM ID (or taxonomy term name)
- Custom Fields and performance
- Sort posts by number of matched terms
- Creating a custom Admin panel
- Remove description in custom taxonomy edit screen
- get_the_term_list without specific category
- How to add custom taxonomy to search
- Taxonomy.php issue with search and filters
- wp_query to display custom taxonomy terms
- How to filter WordPress search, excluding post in some custom taxonomies?
- how to search in custom fields & custom taxonomy for custom search
- Search by type posts and taxonomy
- How to list all record from one custom taxonomy start with only one letter i.e A
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- How to create an advanced filter search?
- Creating an Archive using a Custom Taxonomy
- List Recent Post Titles from Custom Taxonomies?
- Creating a custom search form
- How to implement custom search with input fields?
- How do I keep the page I’m on within the URL when running a search on a taxonomy?
- Custom Taxonomy Term Caching?
- Add multiple taxonomy filters to edit.php that support search
- WordPress sort search results by custom order
- Extend & Search Native WordPress Image Galleries With Tags and Taxonomies?
- Some of my custom taxonomies are not showing but still counted in a WPMU set up
- Custom Taxonomy Not Working When added to WordPress Search
- add hirarchy of categories in products grid of visual composer
- Search Tool only refreshes Page without showing results
- WordPress thinks my custom taxonomy pages are search pages #seo
- Add success message to category add screen
- wordpress testimonials
- Removing “s” from search with custom parameters
- Hiding taxonomies with no children WP_Query & tax_query
- WordPress Custom post query sorting does not work
- Passing form inputs into multi-taxonomy query
- Custom URLs in Custom Search Results
- Custom taxonomy not appearing in menu administration panel
- Search Query for Multiple Terms In Same Taxonomy
- Best structure for entering recipes in a WordPress theme?
- Use an HTML Element To Filter Taxonomies In WP Search
- Get Terms for Page
- Why isn’t the ‘no results’ being shown when a query returns no results?
- Clean Custom URL for Serach + Custom Taxonomy
- Advanced search redirecting to another page then filter further
- Add attribute taxonomy through code don’t appear in admin product page
- Search only custom taxonomies
- Best way to redirect taxonomy terms to pages
- Create alphabetical Pagination for custom taxonomy?
- WordPress autocomplete search with taxonomies
- Geographic search with taxonomy structure [duplicate]
- Taxonomy Overview Page?
- Featured Images for Tags?
- search using multiple taxonomies and keyword
- Taxonomy or Custom Field
- Query Multiple Custom Taxonomies
- Use wp_list_categories to list parent categories from actual term
- Multiple Drop-Down custom taxonomies search
- Filter with two id of the same value CPT UI(taxanomies)
- Amend taxonomy to search in wordpress admin
- Include get_term_link inside search
- How to have multiple search result pages in wordpress with taxonomy terms listed
- Product custom taxonomy is not found when space in name
- Rewrite Search URL Permalink For CPT Custom Taxonomies
- Search custom taxonomy via query-string?
- How to exclude woocommerece product category in search results?
- Remove Custom metabox from particular page template is used
- Restrict viewing of posts by category, user role
- Assign a default description to new terms under a custom taxonomy
- WordPress custom taxonomies new/edit post autocomplete
- Post not showing in my custom advanced search
- WordPress tag or archive php file customization
- Best Method to Switch Between Terms (Custom Taxonomy)
- WordPress shortcode Issue!
- Include attachments with a custom taxonomy in search
- Search & Replace trailing strings
- Why is it defaulting to “uncategorized” even after I select a custom taxonomy
- Custom taxonomy displayed in search results
- How to perform a search inside a specific taxonomy category
- Trying to achieve row posts below category with multiple loops in custom tax
- Advanced WordPress search form based on custom taxonomy and custom meta value
- Search and filter with custom field in taxonomy
- get_terms showing link to category even if all posts are drafts
- How get custom field from custom taxonomy?
- AJAX response, edit tags
- How to get custom category’s link?
- Edit custom taxonomy description programatically
- Get taxonomy name for the current post
- Duplicate slug/permalink issue
- How to list the taxonomy terms that fit the custom query?
- How to loop custom posts that have an exact match in taxonomy terms?
- Display custom post taxonomies