WordPress Tutorial Videos by WP101®

175+ WordPress tutorial videos for non-techies.

  • About Us
    • Top WordPress Products
    • Testimonials
  • WordPress Tutorials
    • Intro to WordPress
    • WordPress 101
    • AIOSEO 101
    • WP Mail SMTP 101
    • Easy Digital Downloads 101
    • WPCode 101
    • WP Simple Pay 101
    • RafflePress 101
    • Elementor 101
    • WPForms 101
    • Spectra 101
    • How to Blog Better
    • WooCommerce 101
    • Beaver Builder 101
    • Ninja Forms 101
    • WP Rocket 101
  • Help Forum
    • Hire a WordPress Expert
  • Blog
  • Contact
  • Sign In

How do I highlight matching terms in WordPress search results?

Get answers to your WordPress questions!

Tired of wasting time scouring Google for answers to your WordPress questions? Since 2008, we've helped countless WordPress site owners just like you get unstuck. Get answers to your WordPress questions — plus unlimited access to our entire library of 150+ WordPress tutorial videos. Why not join us today?

View Membership Options
WordPress Questions and Answers › How do I highlight matching terms in WordPress search results?
0 Vote Up Vote Down
Martin Roberts asked 5 years ago

I wonder if anyone can help me with an issue I am having with 'search' in WordPress/WooCommerce.

I am building a database of artists and architects who have worked on English Churches: http://staging.englishchurchartandarchitecture.co.uk/

I need to find a really good search solution.

So far, I have gone with a paid plugin called Ajax Search Pro which is doing a good job, but has one major drawback which may mean I have wasted the cost of the plugin! It doesn't highlight search results on the results page.

The nature of this site means that a large portion of the likely search terms will be buried in the content of the entry.

As the site is very much in the development stages and only one letter of the alphabet has been populated, it's not that easy to appreciate the nature of this problem fully.

However, taking 'Smith' as an example; if you enter 'Smith' into the search field it does return entries (which are, in effect, WooCommerce 'products) which contain 'Smith'. Even with only one letter (A) populated, there are several entries that contain Smith. It's going to be a pretty poor user experience if you cannot see at a glance which entries contain the Smith you're looking for.

I have contacted the plugin developer and he has said a flat 'No' to this feature.

I found this snippet: https://perials.com/highlight-searched-terms-in-wordpress-search-results/

Frustratingly, with my theme, there's a glitch (we think this is theme related). It works perfectly with results that aren't wrapped in an anchor tag. For reasons no one has been able to figure out, when a search result is wrapped in an anchor tag, the snippet renders the code as text so instead of being nicely highlighted, it appears something like this:

Armitage and <span class="search-highlight">Smith</span>

For the record, I have also tried a plugin called Highlight Search Terms. This only works partially, which is barely better than working at all!

So ... I would REALLY appreciate if you could advise me on a solution which:

  1. Directs users to a search results page
  2. Searches Titles, categories AND search terms within content
  3. Highlights the results on the search page

If it helps, I am running a theme called 'Roof' from Victor themes, WP 5.4.1 and WooCommerce 4.1.0.

Thanks,
Martin

1 Answers
0 Vote Up Vote Down
Shawn Hesketh answered 5 years ago
Hi Martin, I wonder, have you taken a look at the Search module within Jetpack? Jetpack Search completely replaces the default, limited search capability built into WordPress. It provides better results and includes the features you mentioned above, and more:
  • Instant search and filtering without reloading the page.
  • Real-time indexing supports your search as you type.
  • Theme compatibility for both desktop and mobile.
  • Prioritized results based on your site traffic.
  • Spelling correction and highlighting matching terms.
Jetpack Search is not available in the free version of the Jetpack plugin. Rather, you'll need to purchase a subscription to that particular feature, which starts as low as $5/month, and increases, depending on the number of records indexed. Still, because Jetpack Search is powered by Elasticsearch and a network of globally distributed data centers, it's easily the most powerful way to improve the search experience on your site. Hope this helps!

Please login or register to join the conversation!

Share this with someone?

FacebookTweetLinkedIn

Most Recent Questions

  • I took the Sprectra 101 course. Now I’m building my won web site but I still have the Specra Style Guide and I think it’s causing an issue with Sprectra One. How do I get rid of the Style guide? asked by Mallis01, 2 years ago
  • Can you offer any tips, or best practices, on how to redesign and upgrade an old website? asked by FSAuthor, 2 years ago
  • How to create a blog in Spectra? asked by TJ, 2 years ago
  • How do I make all the words show Uppercase? asked by iLoveToLiveWell.com, 2 years ago
  • Why does my right side dashboard top look different than course. asked by Blues1947, 2 years ago

Site Links

  • About Us
  • Your Account
  • Products We ❤️
  • Affiliates
  • Testimonials
  • Blog
  • Contact Us

Courses

  • WordPress 101
  • WooCommerce
  • Elementor
  • Spectra
  • WPForms
  • Ninja Forms
  • View All →

Products

  • WP101.com
  • WP101 Plugin
  • Embed our videos on your site!

Recent Posts

  • How to Set Up 301 Redirects in WordPress (Step-by-Step Guide)
  • 5 Best WooCommerce Review Plugins for Power Sellers (2025)
  • WordPress SEO 101: The Ultimate Guide to Optimizing Your Website
  • 11 Best Business WordPress Themes (Proven to Convert)
  • How to Sell eBooks on WordPress: The Complete 2025 Guide

Connect with Us

  • Email
  • Facebook
  • Twitter

WordPress Tutorials by WP101© 2008-2025 WP101® LLC. All rights reserved.
WP101® is a registered trademark with the U.S. Patent and Trademark Office.
WP101® is hosted by SiteGround.
Privacy Policy | Terms of Use | Disclosure | WP101 Coupon