WordPress.org

Support

Support » Themes and Templates » Decode » [Resolved] Small bug in search resultst

[Resolved] Small bug in search resultst

  • Hello,
    you are using a preg_replace command inside the search result’s excerpts to highlight the search keys.
    Unfortunately the read more links are manipulated as well when one of the search keys are part of the url – which is very common when using perma links

    Jürgen

Viewing 4 replies - 1 through 4 (of 4 total)
  • Oh nice catch! Any idea on a good way for me to fix this? I’d like to keep this feature, but even though this is a niché bug, there’s got to be a decent way to get around this.

    I am not a champ with regex.
    When challenged this way I always work with three steps instead of trying to force everything into one regex statement
    1. Mask/remember the part that should not be changed. Store URL and replace them for the moment with XXX
    2. Highlight as usual
    3. replace XXX with the stored value

    This is fixed in 2.8.5 thanks for bringing this to my attention.

    Although the fix has a small problem because it adds a filter to the_title which means if the search term is also a page in the navigation menu, it will be highlighted. 🙁
    Not really that bad. Maybe I’ll even call it a feature. 😉
    I’m still looking for the very best way to do all this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Small bug in search resultst’ is closed to new replies.
Skip to toolbar