WordPress.org

Ready to get started?Download WordPress

Forums

Decode
[resolved] Small bug in search resultst (5 posts)

  1. Juergen Schulze
    Member
    Posted 7 months ago #

    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

  2. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    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.

  3. Juergen Schulze
    Member
    Posted 6 months ago #

    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

  4. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

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

  5. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    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.

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.