Skip navigation

Understanding and Fixing WordPress Search

There is a lot you can do with WordPress regarding searching your blog. You can use the built-in search capabilities, replace it with a search from Google or Yahoo (or whoever), or use an awesome WordPress Plugin called Search Everything to really get full advantage of searching your blog.

Let me explain what and how the built-in search function works with WordPress, for those left confused and frustrated as I was.

How WordPress Search Works

When you search in your WordPress blog, your search results are listed chronologically. Not by “most likely”, “most popular”, “most frequent use of the phrase”, or even alphabetically, just by date. And the chronological order runs from most recent to oldest. If the most likely post to provide the information the user is searching for is older, they will have to scroll towards the end of the list to find the most likely candidate for information. What are the odds they will, huh? This frustrates me no end.

Another frustration with WordPress searching is that it only searches posts. It does not search comments nor Pages. Only post content.

Another thing happens internally that the user never sees, but you, the administrator and/or Theme designer, need to know about. By default, there is a hierarchy to the order of which template is used for which request. A Theme may, or may not, have these optional template files to generate specific web pages, page elements, and looks. In the case of search, when the user clicks the SEARCH button, WordPress looks for a search.php template file. If it doesn’t find it, it will generate the search on the index.php template file.

You can see examples of my main website’s custom index.php page and custom search.php page to get a feel for how these can be customized. The index page features huge excerpts and graphics, while the search results excerpts are shorter, but look similar in design.

A Theme doesn’t have to have a custom search template page, but if they do, it allows customization of how the search results look and feel. Nothing has to be changed within the rest of the templates in order for a custom search template to be added. If you want to add a custom search template, simply copy the search.php template file from another WordPress Theme, or make a copy of the index.php template file and rename it search.php, then style it to match whatever you want your custom search page to look like. No special coding is required. WordPress will automatically find it next time you go to search. Hopefully. 😉

For more information on customizing or creating your own search page, see Creating a Search Page in the WordPress Codex, the online manual for WordPress users, designers, and developers.

Replacing the WordPress Search

To replace the built-in WordPress search functions with a search engine search function, simply sign up and get the XHTML codes for the search engines search function and edit the searchform.php to remove the built-in PHP search functions and replace them with your new code. The WordPress code looks approximately like this:

<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div class="searchinput"><input type="text" 
class="inputbox" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" class="button" value="Search" />

Be sure and test the search engine search functions thoroughly, and style the search engine search to match the look of your WordPress Theme, if necessary. Some search engine functions will allow you to specify a search results page, so if you can, why not make the search results look like your WordPress Theme by generating them on a search.php template file to match the overall look.

The Search Everything WordPress Plugin – Easy Search Expansion

To get around the limits of the WordPress search functions, without replacing it with a search engine search form, the Search Everything WordPress Plugin expands the search results to include comments and Pages, though currently it also returns only chronological results, from most recent to oldest posts.

To install Search Everything, upload the plugin to your wp-content/plugins folder and activate it through your Plugins Administration Panel. That’s it. It works. If you have messed around with your searchform.php template file, you may encounter problems, so check through the comments on the Search Everything WordPress Plugin page for more help, or ask.

Site Search Tags: , , , , , , , , , , , ,
Copyright Lorelle VanFossen


  1. Posted February 11, 2006 at 7:17 pm | Permalink

    Nice article Lorelle. I still find the search insufficient because WP allows you to do many more things by its functionality. But the search is not up there yet, e.g., I will not be able to search in any data that I create which is not wrapped in WP posts. It currently does not search through excerpt of posts or the other custom fields. While changes can be made to make WP search everything, it depends more on the types in the MySQL database. It would be more flexible and efficient, if it is built into WP design. We can then even have something like an Advanced Search or a filtering process.

  2. Posted February 11, 2006 at 9:11 pm | Permalink

    One odd thing I have noticed with the search on is it also searches the html tags. If I search for the word strong, I get every post that I have made a word bold in. ()

  3. Posted February 11, 2006 at 10:46 pm | Permalink

    Wow! I hadn’t noticed that one. Yikes. Though it is neat if you are searching for a specific tag. 😉

    Do other searches ignore HTML?

  4. Posted March 7, 2006 at 12:22 pm | Permalink

    I thought your article was great, this was just the information I was looking for.

  5. Posted June 4, 2006 at 8:06 pm | Permalink


    Would you mind posting or emailing your search.php file please? I want to see how you created the excerpts and the block text thing next to each search result.



  6. Posted June 4, 2006 at 10:07 pm | Permalink

    I explained how to do this in Designing Themes for WordPressMU – Fill in All The Details. Just change the_content() to the_excerpt() in the search.php template file. I put that section in a specific CSS class and added the border to make it look distinctive when viewed on the front page, search, and category results. Nothing fancy. You can find more details in WordPress Codex – Creating a Search Page.

    I will be addressing some more specifics about creating a custom search, category, author, and other template files in the next month. Stay tuned.

  7. Posted July 23, 2006 at 2:14 pm | Permalink

    You said that “Some search engine functions will allow you to specify a search results page”. Can you give some examples?
    Thank you.

  8. Posted July 23, 2006 at 3:51 pm | Permalink

    You’ll have to check with the various search engines services, like Google Search or Yahoo Search, and find out how they allow you incorporate their search functions within your WordPress Theme. I may be doing that in the next month, and I’ll report on this then.

  9. Posted July 26, 2006 at 4:15 pm | Permalink

    Does anyone know exactly where the code for the search is? I’m looking for the code that actually does the MySQL fulltext search for the posts. I’ve found the searchform.php file which spits out the search input field and the button. I’ve also found search.php which is the template for displaying the search results. But, I’m looking for the actual php/mysql code that does the searching. Thanks!

  10. rbs
    Posted August 11, 2006 at 7:11 am | Permalink

    Replacing the WordPress Search
    the default action is 1) bloginfo(‘home’);
    and that you suggest is 2) $_SERVER[‘PHP_SELF’]

    what is the difference?
    Can you to do an example?

  11. rbs
    Posted August 11, 2006 at 7:18 am | Permalink

    I ask this because the adefault action really isn’t a
    file.php but only a folder so I not understand how it work.
    what is the file that treat the variable s;
    identical for your suggest (..PHP_SELF), the file is the same of the form, but if so you can to do examples of code for treat the datas

  12. Posted August 11, 2006 at 8:15 am | Permalink

    Ah good catch. I posted the customized PHP code from an old default WordPress Theme version. I’ll change it to the new, and more appropriate one.

    As the instructions say, sign up for a new search engine searching service and you will be given the code to use and search for the above code and replace it with your new code.

    Thanks for the catch. See Creating a Search Page in the WordPress Codex for more information on the search functions. As for your answer, that was the old method, and this is the new, replacing PHP function with WordPress template tags, a much more powerful usage. The result is basically the same.

  13. rbs
    Posted August 11, 2006 at 9:51 am | Permalink

    Creating a Search Page at the end reuse the searchform.php;
    but if I want really a different search engine type:

    to do a search smilar:
    search category and custom field;
    or search word 1 and 2 and 3 (not exactly phrase but all the words) etc…;
    any ideas

  14. Posted September 18, 2006 at 3:55 am | Permalink

    Do you know where the actual function to search is performed? I want to alter the SQL consult but can’t find it.

  15. Posted September 18, 2006 at 8:31 am | Permalink

    I don’t understand your question. Do you want to do a search and replace within the database? Or improve the search function on a blog?

  16. Aleyda
    Posted February 23, 2007 at 9:22 am | Permalink

    Hello Lorelle! … Your post is really interesting.. but I have been trying to find (with no luck.. maybe you know about this) what is the algorithm used by the WordPress Search System… also.. where I can find its search function?.. does it have the capability to order the results by relevance?…if it has it.. how does it make this relevancy ranking?… I have checked the DB and it doesn’t create any search-related table… 🙂 thanks for your response in advance..

  17. Posted February 23, 2007 at 9:57 am | Permalink

    Hmm, the best I can recommend right now is checking through the various WordPress Plugins listed here and in Helping WordPress Search With WordPress Plugins. And for the real answer, ask Mark Jaquith. 😉

  18. ryan
    Posted August 23, 2007 at 9:51 am | Permalink

    When I use the sidebar widget search it adds a break before the search button. Why does it not use the searchform.php and how can I change this?

  19. Posted August 23, 2007 at 10:12 am | Permalink

    This is one that you will have to ask on the WordPress Support Forums. I’m not familiar with the search widgets and how they work. Yet.

  20. Posted January 2, 2008 at 12:32 pm | Permalink

    Thank you so much for posting this Lorelle. I have had a lot of trouble with my WP search. Actually it doesn’t return any results for anything I search for.

    When I build themes I do it on another dev site, and the searches work fine. But when i bring that theme into another existing site and start using the theme, the search doesn’t work. I have had this happen on 3 or 4 different themes.

    i thought that maybe i had tweaked something a long time ago that inhibited it from working so I downloaded the newest WP (2.3.2?) and re-uploaded everything and then added in my theme again to get a fresh start, but the search still isn’t returning any results.

    I am going to try your suggestion for the “search everything” plugin to see if that will help.

    if by chance you might know why I’m not getting any results I’d love to hear about it. But at least your article gives me hope.


  21. Posted January 2, 2008 at 1:23 pm | Permalink

    @ Drew Stauffer:

    I believe there are some newer search Plugins to try, so look around if that one doesn’t work. The next version of WordPress is slated to have improvements for searching both pages and posts.

  22. Posted January 2, 2008 at 2:06 pm | Permalink

    I replaced my search with a Google Custom Search engine for a while…

    The unfortunate thing was it didn’t work well with ignoring specific posts… I didn’t want to return tag pages, and archives in the results.

    One nice feature was it would return results based on comments.

  23. Posted February 10, 2008 at 8:54 am | Permalink

    My default wordpress search doesn’t work, I’ve tried many plugins and always get the same result … “No posts found. Try a different search?”. Can anybody help me please? I’ve been through the wordpress support forum many times and can’t find anything that would help.

  24. Posted February 10, 2008 at 10:29 am | Permalink

    @ Jaka:

    I recommend you try a different WordPress Theme. If the search works, the problem is with the Theme. If it doesn’t work, do a total clean reinstallation of WordPress (backup everything first, delete database, remove everything from the server. Then install.) and see if it works then.

    If it doesn’t, consider checking with your web host as there may be some glitch on their end, though unlikely, and then keep asking on the WordPress Support Forum as they are your ONLY source for such help. Plugins aren’t the answer.

  25. Posted February 17, 2008 at 10:50 am | Permalink

    I wuse UTW it makes links to the search, but uses blah-blah instead of spacing or + signs. the search hates this. i want to add

    $wp_query = str_replace("-", " ", $wp_query);

    before the search is kicked off. Do you by chance know where I could place that code? where is the actual file that runs the search function?

    Quince Wyss

  26. Posted February 17, 2008 at 8:46 pm | Permalink

    @ Quince Wyss:

    The Ultimate Tag Warrior WordPress Plugin is no longer supported. If you are using it on your blog, that means you have not upgraded your version of WordPress. If you have not upgraded, you have been ignoring the very publicized mandatory security upgrades. WordPress blogs not upgraded have been hacked as trouble makers are seeking out those versions.

    Upgrade immediately. The latest version of WordPress includes tagging and has an import feature for UTW. There are numerous Plugins, some by the same author, for the new native tags.

  27. Posted February 26, 2008 at 6:34 pm | Permalink

    Thank you! This indeed was exactly what I was looking for. I’m seeing that only post content is searchable. I can search for and find categories, BUT if I search for Uncategorized I get no hits even though I have several. Now that I think about it though, when I checked out the database, there were to taxonomies. I wonder if Uncategorized and my other categories were of such that the search only hits one taxonomy? Hmm. Well, at least I have an idea of the scope of the search, and no longer worried that it’s broken. I just had to fix a broken theme that I like but gave a 404 page not found whenever you click the Search button. With your info, I can move on to other tasks and have faith the search works as it was coded for.

  28. Posted February 26, 2008 at 8:47 pm | Permalink

    @ Jason Smith:

    If you are looking for posts within your “uncategorized” category, use the Manage Posts panel and set it to filter posts by category. That will show you everything in that category. Edit each one and put them in their right category.

    Always glad to help.

  29. Posted May 13, 2008 at 4:49 pm | Permalink

    Can you give me some feedback as to how to get the search posts function working in the admin section?

  30. Posted May 13, 2008 at 10:10 pm | Permalink

    @ Jeff:

    No. It works for me. Please try the WordPress Support Forum for more assistance.

  31. maddler
    Posted July 9, 2008 at 4:20 am | Permalink

    Any clue on how to change the number of results in search page? Af far as I know it obeys to global post per page configuration.


  32. Posted August 1, 2008 at 1:53 am | Permalink

    I do not know whether anyone has noticed this. The search function in my blog comes with the theme I’m using and everytime I do a search, the number of results I got is exactly as the number of posts I set at the Reading Settings. That is, if I set my blog to display 5 posts only, the search also produces 5 results. It’s annoying, somehow.

    Can anyone recommend how to change this? Thanks heaps 🙂

  33. Ravi
    Posted January 9, 2009 at 5:28 am | Permalink

    Thanks for this article, Lorelle.

    Just as you mentioned at Customizing Your Theme Sidebar, if I were in charge of WP world, I’d definitely want to edit the title for Search widget.

    I have both Google search as well as site search, but whereas the the former does indicate “Google Search”, the site search (WP widget) simply says “Search”. I’d love to change it to “Site Search”, so visitors are not confused by the two search boxes.

    Any help here will be highly appreciated. Thanks 🙂

  34. Fernando
    Posted February 17, 2009 at 2:53 am | Permalink


    You can change the number of post displayed with this on search.php (just before your loop):

    I get it from
    Works great with WP v2.7

  35. Posted May 5, 2009 at 9:14 am | Permalink

    Lorelle, I’ve been trying for hours to figure out how to get search results to display full post results (or even excerpts) on my Kubrick Theme. Right now, I just get headlines, which makes it difficult to discern the content within. So far I found this: but when I look for the elements it describes, they don’t exist. I really like kubrick, and use it as a private blog, so I would like to continue with it rather than switch templates. That being said, if there’s a search.php template that I could use, it would be great. I liked the example you give, but am not sure where to find something like that.

    Is there a way I can easily change the kubrick template and get these results? Thanks!!

  36. Posted May 27, 2009 at 1:28 am | Permalink

    Hi Lorelle,

    Thanks for the article. I have a query regarding the variable name used in the searchform.php. With the statement
    <input type="text" class="txt" name="s" id="s" value="" …
    the URL is shown as

    I want the URL to show like

    so I changed the above statement to
    <input type="text" class="txt" name="keyword" id="keyword" value="" …
    but now the search won't work!

    I also changed all references to 's' in
    to 'keyword'
    but to no use.

    Any clues?

    Thanks again for all the guidance.

  37. Posted June 10, 2009 at 2:50 am | Permalink

    Another frustration with WordPress searching is that it only searches posts. It does not search comments nor Pages. Only post content.

    But in my project it searching page but i don’t want search page what can i do.

  38. Strictly
    Posted August 3, 2009 at 11:44 am | Permalink


    I just wanted to say a big thank you to you for this wonderful post. Google’s custom search ain’t compatible with my blog as the search results always spill into the sidebar. With your knowledge I’ve been able to create a search.php with adsense added to the top and bottom of the search result page. I’ll be trying section targetting on it to see if the adsense ads stay relevant to the search keyword. Once again thanks for a great post.

  39. Posted August 7, 2009 at 12:18 pm | Permalink

    Thanks for this Lorelle,

    I recently found a great little plugin called Relevanssi that will order the WordPress search results by relevancy rather than date. It’s worked out well for me so far, and it even inspired me to include it in my most recent CMS plugins post.

    Anyways thanks for the great articles and advice!

  40. Posted October 22, 2009 at 3:46 pm | Permalink

    Issue of pseudo-receipts, like counterfeiting of coin, is an example of inflation, which will be studied further below. ,

  41. Posted May 28, 2010 at 4:26 am | Permalink

    I was using search everything plugin, but it ate load server, so my blog often down. Now i am looking pugin that has function as search everything but does not consume load server, any idea?

  42. Posted August 26, 2010 at 1:21 pm | Permalink

    how can the default search lookup the category names as well? seems to be finding everything but the string variables of a category. should I tag the posts to the same value as the category name?

  43. Marcos
    Posted October 10, 2010 at 10:00 am | Permalink

    Thank you sooooo much I just spent 5 hours tryinh to set up a custom search and in 5 seconds I got it done after reading your posts. A million thank yous

  44. Ray Do
    Posted October 23, 2011 at 1:05 pm | Permalink

    Say Lorelle, Thank You so much for your “Search” article. I know that it’s now 2011 (…almost 2012), but I am wondering if there is a solution to my search dilemma.

    My site is built on pages. I need two types of searches; both searching all texts on each page consisting of 4 letters and above.

    The first search would be a global search for the entire list of pages with or without sub-pages; the second search would be restricted to a specific category with and/or without sub-pages.

    Thanks Lorelle.

    • Posted October 23, 2011 at 4:49 pm | Permalink

      Wow, I’m sorry you built your site on Pages. That’s so painful. I’d check with some external search features to add to your site as what you really want is a search within the search. I wouldn’t restrict by Pages, Categories, etc., just a search within search. Simpler for the user. Google, Yahoo, Bing, and Legit have those options in their search add-ons.

      If you get smart and rethink the whole Pages versus posts thing, there are some WordPress Plugins that will help you convert Pages to posts and the reverse.

      • Ray Do
        Posted October 24, 2011 at 4:49 am | Permalink

        Good Morning Lorelle. The reason for pages instead of posts is that mine is a directory site for a large school. The senior staff, along with each faculty member (over 275) has her/his individual page that, for now, I do all of the updates myself (ouch). The homepage sidebar and search serves as a global directory listing and search. The hierarchical structure also divides the faculty and staff according to position (administration) as well as class section (9) to which I would like to provide an individual search option to each.

        The reason for pages versus posts allows for the alphabetical directory listing that posts do not allow.

        Of course, ANY ideas and suggestions would be hugely beneficial here. I am not too deep in the implementation that I can not change up.


      • Posted October 24, 2011 at 2:15 pm | Permalink

        There are membership Plugins you can use to make your life easier. For search, I’d use what I recommended, then look into the Membership and Directory Plugins and try the Officers Directory WordPress Plugin to seriously make your life much easier. And Mikko’s recommendation is one option.

      • Ray Do
        Posted October 24, 2011 at 7:07 pm | Permalink

        Hello Lorelle. Just wondering if, given a better view of my site’s purpose and criteria, do you still feel that I should switch from pages to posts? If yes, why??

        Also, I did look into Officer’s Directory though didn’t quite see (even with 4 eyes) how this could/would help. Perhaps further insight from you would help.


      • Posted October 26, 2011 at 8:32 am | Permalink

        I’m between client meetings so in brief:

        Pages and Posts can be anything and maybe what you really need are custom post types not Pages, which are Pages, but treated differently in the taxonomy which would actually be better for you as you could use any of the sophisticated bread crumb Plugins that deal with custom taxonomies. That would be smarter.

        The Officers Directory creates a custom list of faculty, directors, employees, whatever, with links to their pages or whatever you want to do. The author, Douglas Bell, is in college and did this for his college associations. If you needed it customized even more, ask him. I’m sure he’d jump at the chance to make a few dollars to offset his expensive college bills. What I love most is that if you have an opening or vacancy, you can put that in fast and easy. It’s excellent for controlling employee lists and such.

        As for what you are doing, you are trying to reinvent a wheel that has been invented many times before. WordPress is commonly used as a directory and membership. Find out what they are doing. Consider going WordPressMS and give everyone a blog, which they would have to keep updated with their own information rather than you do it, and give them their own class posts and ability to do all kinds of fun things. There are so many options, why not explore all the possibilities out there with WordPress. And check out all the great Plugins that can help make your life easier.

        Or just keep doing the legacy work you’ve been doing and just add a custom search with the option to search within the search. That’s simple if you are entrenched. I like playing smarter and giving up on legacy stuff as fast as I can if I know it’s broken.

        Hope that helps!

      • Ray Do
        Posted October 26, 2011 at 9:13 am | Permalink

        Good Afternoon Lorelle.

        I am one to definitely work smarter… not harder.

        This project was thrusted upon this WP newbie because they can both require and expect this of a lowly IT (hardware) techie in this economy AND they will not spend money that they don’t have. But alas….

        Since having been handed this assignment, I’ve been crash-learning WP so “…custom post types not Pages, which are Pages, but treated differently in the taxonomy which would actually be better for you as you could use any of the sophisticated bread crumb Plugins that deal with custom taxonomies.” are somewhat new to me… right now anyray.

        I’ve already contacted bot Douglas and Mikko for ideas as well.

        What they REALLY want is both… I manage certain sections of their ‘pages’ and they register and manage the rest of their own post… pages… whatever.

        What I need is a ready and functioning solution that I can reconfigure and make my own.


        … In Trouble, But Need the Job

      • Posted October 26, 2011 at 5:55 pm | Permalink

        I totally understand. Douglas and Mikko are great and will probably help you plenty. Good luck with it and know that you are not alone, so look for others who’ve solved this same issue and learn from them. They are the ones who invented the wheels already. 😀

    • Posted October 23, 2011 at 10:27 pm | Permalink

      Relevanssi can do what you need, Ray Do.

    • Alex
      Posted January 9, 2012 at 7:28 am | Permalink

      Hey Ray Do, Just curious how that project turned out (or is turning out)? I’m working on a similar project and I’ve been crash learning WP as well. I’d love to bounce some ideas off you.

  45. Ray Do
    Posted October 24, 2011 at 4:54 am | Permalink

    Thanks Mikko. I’ll check it out.

  46. Barb Ledwon
    Posted May 20, 2012 at 4:05 pm | Permalink

    I am just starting a web page and know nothing of what Word Press is let alone setting up a web page

  47. Jeff
    Posted December 9, 2012 at 4:17 pm | Permalink

    Hey, My search function displays “No relevant search results found” on every query. Not too sure how to go about fixing this issue. If you could give a look and see what you think the problem is I would greatly appreciate it.

    • Posted December 11, 2012 at 4:13 pm | Permalink

      This is an old post and WordPress has fixed their search extensively. If you would like to hire me for testing your site, please use my contact form for such a request. I highly recommend you seek help on the WordPress Support Forum first. Without more specific information, I and others could not help you as the search could be broken within the Theme, with some Plugin that interferes with the search functionality, or your site may not be properly installed. It is rare for search to not work. Good luck with it.

  48. sorbsaha
    Posted January 26, 2013 at 6:33 pm | Permalink

    Hello There!
    My Theme is having search.php code linking from index.php by ‘if’ condition for search, category, tag etc. But when i am searching anything, it is showing random posts rather then the related search results.
    Can you provide me the default code to insert at search.php to unlink that main index and create related search results ?

    • Posted January 26, 2013 at 10:56 pm | Permalink

      Contact the author of your Theme or the WordPress Support forum. The search page is generated by default in WordPress. No special instructions are necessary. If the author has done something different from normal, please contact them as they must have a reason or ask in the WordPress Support Forum for assistance as someone may be familiar with that Theme. Be sure and name it in the title of your question.

      Changing the core Theme makes updating the Theme difficult, as you may have to recreate what you did. Having the Theme author fix it is the best path. Thanks.

  49. Miguel
    Posted July 29, 2013 at 3:01 pm | Permalink

    Thanks for the article.

    I was wondering, though, if you could add dates to your articles. Based on the comments I guessed this was written in 2006, but it would be helpful to know that information right when I begin reading the article. Even if the article is as old as 2006 I’ll probably read a portion of it since I like to know the history of the code I’m working with, but the date will let me know if I need to look for newer information. (If an article is from 2006 I’ll probably look for new information). I find a lot of blogs that don’t date their articles (if you do it for SEO reasons, I hafta tell ya it doesn’t work!! Google and Bing know when you posted this thing 😉 ).

    Again, that’s for the info.
    Take care,

  50. San
    Posted August 10, 2016 at 2:29 am | Permalink

    Hi Lorelle,

    I have 2 queries :

    1) I copied a string from a post. Now, when I search this term with 86 characters (including spaces), it returns me the post as result.
    Now when I copy this term with one additional character copied from the post string, it returns – No result found.

    For ex.
    ……./?s=Office+has+the+88+abcd+asdasd+asdassdfsdded+to+a+3423423411+sdfsdf+of+a+zxczxcing+p+t => Gives post as search result
    ……./?s=Office+has+the+88+abcd+asdasd+asdassdfsdded+to+a+3423423411+sdfsdf+of+a+zxczxcing+p+to => Gives “No results found” //even though the string exists in the content and excerpt both.

    2) To solve the above problem, I am searching for the same answer for the query asked by Amit, i.e.
    Does anyone know exactly where the code for the search is? I’m looking for the code that actually does the MySQL fulltext search for the posts. I’m looking for the actual php/mysql code that does the searching. Thanks!

    • San
      Posted August 10, 2016 at 6:06 am | Permalink

      Hi All,

      Found the solution to both queries.
      Does anyone know exactly where the code for the search is?

      >> wp-includes/query.php => function parse_search()

      Have a good day.

    • Posted August 11, 2016 at 9:17 am | Permalink

      Search in WordPress was fixed many years ago.

      Glad you found the solution. the query function request is in the wp-includes file, which is a core file and should not be changed directly. You may modify it through a child Theme in the functions.php file.

      Hope that helps. support forums is the best for this kind of help. Thanks.

17 Trackbacks/Pingbacks

  1. […] Understanding, and Fixing, WordPress Search (tags: wordpress search weblog) […]

  2. […] Understanding, and Fixing, WordPress Search […]

  3. […] those battling the challenges of providing a decent search function on your WordPress blogs, the hunt for the ideal WordPress search is still on. It has improved, but so far, I haven’t found a perfect search WordPress […]

  4. […] now that that thinking was rather narrow. Lorelle Van Fossen has a neat post on why and how, on a WordPress site, you would think about replacing the default tool with a third party search tool (such as, but not […]

  5. […] Gracias | Lorelle […]

  6. […] built in search function is no match for Google’s finely tuned algorithms. Follow Lorelle’s advice and replace it. You can simply replace an existing search box with Google’s AJAX API overlay […]

  7. […] WordPress non fa concorrenza agli algoritmi finemente sintonizzati di Google. Segui i consigli di Lorelle e sostituisci la ricerca WordPress. Si può semplicemente sostituire la maschera di ricerca […]

  8. […] Understanding and Fixing WordPress Search – Lorelle on WordPress […]

  9. […] by an ever-changing Relevance vs. Time calculation. Now, one of the most common complaints/tutorial topics about WordPress involve improving search via extra code, plug-ins, or a better results page. Since […]

  10. […] to Lorelle Van Fossen, WordPress orders search results with the date as a major factor: When you search in your WordPress […]

  11. […] and Fixing WordPress Search « Lorelle on WordPress Understanding and Fixing WordPress Search « Lorelle on WordPress. February 27th, 2011 | Cat= […]

  12. […] Understanding and Fixing WordPress Search – Lorelle on WordPress […]

  13. […] Understanding and Fixing WordPress Search […]

  14. […] Understanding and Fixing WordPress Search […]

  15. […] Understanding and Fixing WordPress Search […]

  16. […] are some valuable tutorials out there that explain how this is done; I refer to them rather than repeat such […]

  17. […] read this and … and apparently I can’t link to all the other things I’ve read as this is my […]

Post a Comment

Required fields are marked *

%d bloggers like this: