EDIT – The current version of WordPress supports relevance, so this answer is no longer accurate.
There’s no concept of rank or relevance, it’s just a simple LIKE query on the post title and content:
($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')
You can use the posts_search
filter to modify or completely replace the search query with your own. From /wp-includes/query.php
:
// Allow plugins to contextually add/remove/modify the search section of the database query
$search = apply_filters_ref_array('posts_search', array( $search, &$this ) );
Also see the available query filters on the WP_Query
Codex page.
Related Posts:
- Solr vs. ElasticSearch
- How can I implement a location based (zip code) search in WordPress?
- How to highlight search terms without plugin
- How to make search include data from wp_postmeta?
- How do I search events between two set dates inside WP?
- Search Using Post ID
- Complex Search functionality. Advice needed
- How to use next_post_link and previous_post_link on single posts in search results
- Why is there a class=”screen-reader-text” on my search button?
- template_include for search.php makes WordPress think its on the home page
- can’t limit search to only pages
- How to exclude post body from WP search
- Search outside of the “loop”
- Replace URL with Site Title in Search Results
- Force WP to use a certain search template
- WordPress Single Conditional for Search Page
- get_query_var(‘s’) not working
- How to show a random selection of posts from the search
- Best way to Integrate Google Search?
- Default WP search excluding specific characters, is it possible?
- How to add additional search terms (e.g. synonyms) to the search?
- Combine internal search with Google custom search?
- Any reason why search result lists only one entry?
- Display just child pages of a certain page in search results
- How to make wordpress default search to woocommerce search
- pre_get_posts action: Search by post_title and post_content with different search phrase in the same query
- Searching by meta values showing inappropriate result
- Why won’t is_search work inside functions.php?
- Search functionality – include date, category and author search
- WordPress Search matching hyphenated words
- How to stop WordPress Search form from searching only in current page?
- How can I make a search form that can search taxonomies and posts?
- How can I include author (their archive page) in search results?
- How to search media library alt text and title fields
- how to create search and filter form generating “plus” symbols in url in between category names?
- Change Search url slug for each site in a multisite network
- URL search link for ‘category__and’ instead of php query
- Meta query: How do I return posts within a date period from a given month?
- Creating a Searchable PDF Archive of Publications
- Search media by title and description – Frontend
- Is there a way to add a custom text + link above search results for different searches?
- How to change tab’s title in search results pages? [closed]
- Customise Excerpt start and end
- Display post titles that match string in post content
- Template issues getting ajax search results
- How can I implement Search feature for Membership site?
- WordPress search with quotations returning to homepage
- Search WooCommerce Products in WordPress
- Search – Only search for post meta field
- Search Form Based On Tutorial Not Working
- how to show Author information in search results
- some one help . search not jump to search page
- Why should we use the name attribute with the value “s” in the creation of the search form?
- Sitelinks Search box schema confusion
- The Search FoRM Dilemma || The Search form Templating
- Display Search Results after search 1st link
- Make archive page show up in search results?
- How can I add search box in single.php?
- Connecting Google Site Search with WordPress Taxonomies/Categories/Tags
- WordPress custom search by post type
- WP_User_Query not searching
- “Revision” records in wp_posts have original post type instead of “revision”
- search page not found? (search.php or searchpage.php)
- Search engine for WP as CMS [closed]
- Why does this search.php not work?
- Breadcrumbs: Search result not displayed when static page is on top
- Can’t place two custom post types into the WordPress search query?
- Replacement search plugin that reads widgets or catalogs entire page?
- Media Library / Backend: How can I search for text in the ALT Text field?
- How to fetch Email addres of an author via ID?
- WordPress custom search only works from some pages
- WordPress search – Display the paragraph which has the searched word/term
- Search to include external content
- How to exclude specific post_type from default search?
- Search issue on special Character
- Modify main search form to search user too
- pulling in external JSON search results into WordPress
- How to Integrate Live search in WordPress?
- How to create a custom filter in WordPress?
- search results in custom template search.php
- Search results are showing full page instead of sample
- customize search result in wordpress
- $_GET value is losing it’s space
- Search: display all found matches inside post
- WordPress search.php pulling search results but also matching a page and pulling that information in
- Search Results Customization
- WP search in metadata post
- Search.php Modification Needed
- Search taxonomy terms, not posts
- Add Search Form to Dropdown menu
- I want to edit the search function
- How to display articles based on composed tag
- Change the text “search result for” on search result page
- Search query with quotes
- Search Results with googlemaps
- Search with multiple selects that include tags
- Search results from a specific database table
- Wp admin: I need search meta key from table wp_usermeta in screen custom post type
- search videos on divi builder
- Search keyword store in custom meta key