There were three bugs in the WordPress search highlight plugin; I’ve fixed two of them, but I’m not sure how to fix the third one (it’s pretty minor, anyway [ ]).
The first bug occurs when you do a search, and then do a second search (from the results page). The results for the second search would be highlighted with the words for the first search, because the plugin used the referrer page to find out what the search terms were.
The second bug, some of you who are using my Previous, Next links plugin may have noticed: It completely blows up when search terms have forward slashes in them, (if the search term was empty on a local WordPress search, it would interpret the whole URL as the search string) so when you do an empty search on your blog and click the “next” link, the articles would all be replaced by error messages if you had the highlight plugin enabled. That’s a pretty rare thing, but it could happen.
The third bug is that if you do a search, then any link on your site that you go to from the results page will be highlighted. Of course, that’s the desired functionality most of the time, but if you click the “home” link or a category link, or some other archive link… you get highlighting that maybe you weren’t expecting. I don’t know how to fix this without breaking the desireable highlighting of articles that are returned by the search…
So, if you want these two fixes, you can get my version 1.3 of the Search Highlight plugin, and if you have any ideas about the third bug, please leave a comment! [ ]
Similar Posts:
- None Found
[...] [...]
[...] [...]
I don’t see any way to fix the third without touching code outside the plugin. But I’m not going to let that stop me. So unfortunately it becomes a plugin with a hack.
Near the bottom of wp-blog-header.h, I’m appending “&olds=$” to the url before we bounce. You might need a ? instead of & depending on your permalink setup.
if ($s && empty($paged)) { // If they were doing a search and got one result if (!strstr($_SERVER['PHP_SELF'], 'wp-admin')) // And not in admin section header('Location: ' . get_permalink($posts[0]->I D) . "&olds=$s" );Then I’m throwing out all the referer junk in the plugin’s get_search_query_terms() and testing for olds= in the query. I don’t think the relevant information will ever be in the referer for the wordpress search (it will be when coming from google/yahoo/...), any info in the referer is stale, from the last successful search.
case 'wordpress': if ( !empty( $_GET['olds'] ) ) { $query_array = array( $_GET['olds'] ) ; break; } else if (!empty($s)) { $query_array = array($s); break; } }Nice plugin, thank you
Making the (Google) Search-Highlight Plugin work with non-space-delimited scripts
The Search-Highlight Plugin for WordPress assumes the blog is written in a script that uses space (and other regular expression \b characters) to mark [[en:Word|word boundary]] (orthographically speaking). For users of Chinese, Japanese kana, among ma…
[...] Search Hilite – Search Hilite highlights the keyphrases people searched for when they come to your site via Google, Yahoo, etc., as well as highlighting search keyphrases when people search your blog with WordPress’ built-in search functionality. I’ve found it doesn’t work wtih some themes, likely a CSS issue, but it’s worth uploading and activating as it does help readers navigate your site and find exactly what they were looking for. See it working here. [...]
Great Plugin,thks. I have some modifications for you that will allow this to work with the new Widgets Plugin.