WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
highlights happening inside script tags (2 posts)

  1. jloosli
    Member
    Posted 2 years ago #

    I've got a page with some in-line javascript in it that crashes if someone arrives at the page when searching for a term that's inside the script. For example, if someone is searching for bob:

    bob
    <script>
    var bob = 3;
    </script>

    Should end up as

    <em>bob</em>
    <script>
    var bob = 3;
    </script>

    Instead, it's

    <em>bob</em>
    <script>
    var <em>bob</em> = 3;
    </script>

    In the meantime, I've disable highlighting, but any chance of updating relevanssi_highlight_terms() so it avoids everything between script tags altogether?

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Here's the current regexp, if you can modify it so it doesn't highlight inside script tags, I can update the plugin, no problem:

    /(\b$term|$term\b)(?!([^<]+)?>)/iu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags