• Resolved skylerh

    (@skylerh)


    Since updating the Relavanssi 4.9.0, the excerpts in my search results show up like this with the code openings and closings
    ie:

    Blog Post
    <span class=”excerpt_part”>My blog post excerpt text here…</span>….

    I disabled the plugin and used the default wordpress search and it does show up correctly

    ie:

    Blog Psot
    My blog post excerpt text here

    Is there a fix for this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter skylerh

    (@skylerh)

    Update: I disabled “create custom search results snippets” checkbox located in the “Excerpts and Highlight section of the plugin settings. That fixed the issue.

    Plugin Author Mikko Saari

    (@msaari)

    Well, that hid the issue, but also lost you the custom excerpts.

    What happened in 4.9.0 is that now the excerpts are being wrapped in span tags as you noticed. What should happen is that your theme should print out the excerpt, wrapped in the tags, and the tags should not be visible. However, something in your theme is escaping the HTML code in the excerpt, making it visible.

    There are two good solutions for this problem:

    1. You can change your theme so that the excerpts are no longer escaped (that escaping should also break highlighting, so fixing this would make it possible to use highlights in the excerpts).

    2. You can change the excerpts so that they don’t include the span tags.

    I don’t know what your theme is doing, exactly, but if you want to fix that, I’d look for esc_html() in the code where the excerpts are printed out. The excerpts should not go through esc_html().

    To change the excerpts, you can use this in your theme functions.php:

    add_filter( 'relevanssi_excerpt_part', function( $excerpt ) { return wp_strip_all_tags( $excerpt ); } );

    Once you add this, you should be able to enable custom excerpts in Relevanssi without any HTML code showing up.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excerpts not displaying correctly after 4.9.0 plugin update’ is closed to new replies.