How to improve the accuracy of wordpress search? The keywords searched by the user only match the title and content!

users search keywords only match the title and content, if an article title and content does not have this keyword, then do not need to display the search results, hope God can give some suggestions! Thank you

Jan.18,2022

this is the reason for the fuzzy search condition that comes with WordPress. You can find the where condition of sql search in the source code


wordpress. When searching, by default, the title (post_title), content (post_content), summary (post_excerpt) and search keywords are compared with like. For more information, please refer to the parse_search function:

/wp-includes/class-wp-query.php -> parse_search()

if you want to modify it, you can modify

add_filter('post_search', function($seach) {
  // $search
  ...
});
through the posts_search hook.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3659d-2c010.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3659d-2c010.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?