• Resolved pommey

    (@pommey)


    Hello, I am reaching out to see if I can get a solution to an issue I am experiencing on my site with the WP Search with Algolia plugin.

    Search results are coming back with all HTML stripped out.

    I noticed the wp_strip_all_tags function and was wondering if there was a way to toggle this off, or if there may be another solution. For things like driving directions, the HTML formatting is important to have in place.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Checking on this one, will follow back up as soon as I can.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Some thoughts based on some internal feedback and the question at hand.

    This is how the original plugin that we forked from handled records, so we did just continue that. It originally stripped out HTML as well.

    The size of the records in Algolia would grow very large if the markup didn’t get stripped, and the markup is essentially irrelevant to search, it would be “cruft” in the record. You’re not searching for markup, you’re searching to find relevant content, and then clicking through from the results to that content.

    Then there’s the issue of how you would display that markup in JS templating, since JS templates typically won’t render “inner” markup, as it’s a possible XSS vector.

    Standard WordPress search results aren’t guaranteed to display all the markup of a post in search results by default. This is typically in cases where the results are set to show just excerpts, instead of the full content, until clicked through to the individual result items.

    So, in short, no, we don’t allow markup in the record, but if you really want to display markup in their search results, you probably can using the PHP powered search, but will need to make sure the initial display is also showing full content instead of just excerpts.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to keep HTML from being stripped in results?’ is closed to new replies.