Hey,
This plugin is great, it does exactly what I need it to do – in the search results page it highlights the text correctly etc. When I click on the post/page to read the full text, the highlight disappears. Is there a way to continue the highlight to the content?
I’m using elementor so I’m not sure if thats killing it?
Hi there!
Is there any chance this plugin will get compatibility with WP Grid Builder in the future? I enjoy your plugin, but the search facet from WP Grid Builder does not work with it, unfortunately. Would love to see this work.
]]>Assume I search for “absence” and a result found mentions “absences” which is the most accurate result, I want the highlight to cover the entire word “absences” with the part of the word that wasn’t typed in the search
This currently exists in Relevanssi, is there any way with your plugin?
]]>Can you please check my website below, and try any search you wish
If you do an AJAX search, the highlight doesn’t appear after clicking.
If you do a HTML search by pressing “ENTER”, the highlight appears after clicking.
https://wordpress-573315-3867085.cloudwaysapps.com/
Can you fix this please?
Thanks
]]>The plugin is brilliant, though I notice an abstruse quirk: highlights of image captions generated by a gallery plugin (JIG) appear for a fraction of a second after page load, then disappear. (Other instances of the text on the page stay highlighted fine.)
I realise it’s not expected to work under all circumstances with all output, but I wondered if that behaviour seemed to flag an obvious problem.
]]>Great plugin. However, it is not reliable. Every time we enter a search term, we have to refresh the page or click the magnifying glass icon one more time to see the term highlighted. This happens with Cloudflare enabled or disabled.
It appears this could be caused by a cache issue, so what generic URL should we exclude from caching when using your plugin? Also, what CSS selectors should we exclude from deferral? If there’s another solution available, please share ??
]]>Need help, if possible, to run this plugin in our environment.
We are using “searchwp” for default search in combination with “Posts Table Pro”
and “Elementor” for defining loop content.
In search results we can see searchwp highlighting mark but not this one from your “Higlight Search Terms”
More importan url to the post does not have your query param and we don’t have higlighting in post opened from link. (We trying your plugin becaus searchwp can higlights in results but not in post)
Can we do something to sort this out?
To be more precise link to this post is defined in Elementor loop as “Post URL” if this clear something out.
Thanks in advanced,
Danilo
I’m using the Divi theme. The results page have the search word highlighted, but one click further and no highlight. Try searching for “solar” to see what I mean. Thanks.
]]>The search works great on the initial search, but if anyone searches a second time (without refreshing the page), terms are not highlighted. I can provide a link privately if needed to test.
]]>Hello
I am currently using WordPress version 5.9.1. On trying to activate the plugin Highlight Search Terms, I am receiving the following error message:
“Plugin could not be activated because it triggered a fatal error.
“Parse error: syntax error, unexpected ‘try’ (T_TRY) in /home/medstats/public_html/wp-content/plugins/highlight-search-terms/hlst.php on line 100”.
This experience has been repeated after deleting the plugin and reinstalling it.
I would be grateful for advice on potential ways of addressing this problem in order that I can use the plugin.
Many thanks in advance!
]]>If I search for a term, the term is highlighted in the results, but not in the page if that page is a template.
I notice the console error:
SyntaxError: Cannot declare a const variable twice: 'hlst'.
Any ideas what might give rise to this?
]]>I notice that search terms wrapped in double quotes always returns no results on mobile.
Is this a known issue with WordPress, or might it be specific to this plugin?
Thanks.
]]>Works extremely well (with a little CSS tweaking)!
But, in my twenty-seventeen-based child theme, when I click through to the page linked from the excerpt, although the highlighting works for the most part on that page, the query string doesn’t highlight the search term when it appears in the page title, which is in a <h1 class="entry-title">
, which is NOT in an <article>
tag.
So, that <h1>
isn’t being given a ‘mark’ tag, so it can’t getting the style colour.
Is there a way I can force it to get the ‘mark’ tag and so receive the colour? (Being the page title, it would be good if it got the highlighting, as that is then a clue to the reader that other instances of the search term will also be highlighted.)
]]>I’m using ivory search bar and it has an ajax option:
Configure how the search button should work clicking on it.
I can select “Search button displays search results page” or “Search button displays ajax results”. I want to do the ajax results only, but the resulting page does not get picked up by your highlight plugin. Can I accomplish this somehow? What do I need to “add” from your plugin to be passed into ivory search bar?
Otherwise, it works great with the traditional search results page. Thanks so much.
]]>Hi there,
it seems you add single quotes to the parameters and search terms to separate them.
Generally this is not needed as all values in there are already strings.
Additionally this triggers security rules of plugins like NinjaFirewall as this is misinterpreted as attack vector (XSS, SQL Injection).
"11/Aug/21 17:30:17 #5166782 HIGH 300 a.b.c.xxx GET /index.php - Leading quote - [GET:hilite = 'some-word'] - example.de"
You might want to remove these single quotes and use a different separator for the terms. Instead of a comma you could use some special ones like :::
, ;;;
, ___
or something else. Maybe double quotes would work but generally it would be probably better to not use quotes as enclosures.
Best is if you test it with the NinjaFirewall when you are logged out to see which cases actually work and which don’t (trigger the security rules).
]]>Your plugin works a treat – one query…
I think that it is highlighting words (i.e. stopwords) that the WordPress search functions are purposely ignoring. See get_search_stopwords (see also parse_search_terms).
Is there a way to make the plugin match the core behaviour? i.e. not highlight words like ‘this and ‘that’. (I also think that ‘and’ is worth considering for exclusion.)
]]>Hello!
Is there any way to ignore Arabic diacritics when highlighting?
I’m not sure if it will help out but I’ve used this code to remove it for some other things, I’m just not sure how to use it in this case:
function arabic_remap( $a ) {
$remap = array(
'?' => '?',
'?' => '?',
'?' => '?',
'?' => '?',
'?' => '?',
'?' => '?',
'?' => '',
'?' => '?',
);
$diacritics = array(
'~[\x{0600}-\x{061F}]~u',
'~[\x{063B}-\x{063F}]~u',
'~[\x{064B}-\x{065E}]~u',
'~[\x{066A}-\x{06FF}]~u',
);
$a = preg_replace( $diacritics, '', $a );
$a = str_replace( array_keys( $remap ), array_values( $remap ), $a );
return $a;
Is there any way you could fix this?
Thanks
]]>Hi, I’m using the highlight search terms plugin for some time now and it works fine.
Now after several of my posts have got a large number of comments I activated the standard WP function for paginated comments and also activated a numeric navigation for the resulting comment pages. This also works fine.
When clicking e.g. on page no.6 of these page numbers, the resulting url will look like:
my-site.com/mypost/comment-page-6/#comments
and this calls the sixth page. Fine.
However – this doesn’t work together with the highlight plugin. ??
After performing a search and calling one of the result pages, this will have an url like:
my-site.com/mypost/?hilite=’search-term’
When I now click on one of the numeric navigations this will result in:
my-site.com/mypost/?hilite=’search-term’/comment-page-6/#comments
Unfortunately this doesn’t call the intended post, but instead just moves the display 2-3 lines up.
So it seems that the highlight plugin is not compatible with paginated comments with numeric navigation? Or do you have some advise what I can do?
Regards, Tooni
]]>Hi, I have used your plugin on several Divi sites and it works great. Currently, I’m working on a site using Elementor Pro with the Astra theme. I created a search results template and while search terms are highlighted on my results page that I designed, they are not highlighted on click-through. Any help greatly appreciated!
]]>Hello,
after successful integration of this highlight search terms plugin through this post https://www.ads-software.com/support/topic/doesnt-work-with-search-filter-plugin/, I have a simple other problem.
On startpage I can set search term in searchbox and I got highlighted results.
But If I search again with another search term I got results but NOT highlighted.
Here is code from plugin (hlst.php):
private static function have_search_terms() {
// did we not look for search terms before?
if ( !isset( self::$search_terms )) {
// try regular parsed WP search terms
if ( $searches = get_query_var( 'search_terms', false ) )
self::$search_terms = self::sanitize_terms( $searches );
// try for bbPress search or click-through from WP?search results page
elseif ( $search = get_query_var( 'bbp_search', false ) OR ( isset($_GET['_sf_s']) AND $search = $_GET['_sf_s'] ) )
self::$search_terms = self::split_search_terms( $search );
// nothing? then just leave empty array
else
self::$search_terms = array();
}
return empty( self::$search_terms ) ? false : true;
}
After first search I got ../suche/?_sf_s=test in address line.
After second search I got ../suche?_sf_s=test in address line.
There is a “/” missing after “suche” and before “?”.
Could this be the problem?
It would be great if someone can help me!
Thanks and best regards!
Hi Ravan,
Someone in the Elementor FB group reccommended your plugin for my need but not sure it will do it.
I simply wanted a way for the visitor to search ON THE ONE page for a word and have it highlite if it’s on that page only. Just like when we go to edit, find in the browser and type the word to find it on a web page. But the site is for kids and they are on a page with nearly 200 songs so I was hoping for a plug-in that had a search box and they type in song name to see if in the list. Many do not know about the edit, find in a browser method.
will your plugin do this easily?
thanks
Barry
]]>This plugin does not append URL with homepage search result
]]>Can I tell it where I want the search terms to be highlighted. Where can I enter the HTML tag ID of the area that contains the text? Because i added scroll plugin in the text box and it highlights everything around the text box and not the actual text in text box… Can you help me out?
]]>Highlight Search Terms doesn’t work with WordPress 5.6.
What a pity!
When you press the Lens button (top right) and enter “alzheimer” as search criteria, the first result is the post “Interview with Marco Blom (Alzheimer Nederland)”. The search term is highlighted.
When you press “Read more” the complete article will be visible, but does not contain any highlighted text. There is a div id=”content” in the page source.
Am I doing something wrong?
Love the plugin – works well!
Is there any way to add search result counts so users can know how many there are. Something that could be added in line with the results:
Search Results: KNIT(4)
Or something like this?
Thanks!
Ray
Hello, Highlight Search Terms,
By implementing the code provided here I was able to temporarily turn off all highlighting on the post page. However, I would like for highlighting to remain on the post page search term and to turn off highlighting on only the post-page-menu URLs.
Your assistance is appreciated.
Michael
]]>Hello,
Please can you add support for this plugin https://www.ads-software.com/plugins/buddypress-global-search/
Thanks
]]>Hi there,
I installed your plugin ‘Highlight Search Terms’ version 1.5.2 in May 2019. I did save the files locally as a backup then.
When I take a look now, this same version 1.5.2 is still mentioned as the most recent one, but… it should be ‘last updated: 3 months ago’?
How is this possible? Did you upload the wrong version 3 months ago? Or just the same version again?
Thanks in advance,
Plimfec
PS When I compare all the files between my May 2019 version and the current 1.5.2 version, they’re all exactly the same.
]]>Ok, this subject sort of came up a couple of times, but not exactly addressing my situation: I set up FacetWP with Relevanssi and FacetWP has a keyword facet that redirects to a custom page instead of search.php for search results. It works fantastically and allows developers to design a search results page that looks like their theme. I love Highlight Search Terms but as others pointed out, it doesn’t work when searches bypass search.php page. Somebody asked 9 months ago “Doesn’t work with Search & Filter plugin?” and the solution may be applicable in my situation. However, I can’t figure out where the code you offered should go. Custom Hooks? Directly in hlst.php? Replacing something or added in line 154? And is this the code?
elseif ( isset($_GET[‘_sf_s’]) AND $search = $_GET[‘_sf_s’] )
self::$search_terms = self::split_search_terms( $search );
Thanks!
]]>