Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari

    (@msaari)

    When Relevanssi builds excerpts, the post content is passed through the_content filter, which should make the shortcodes expand.

    You could try adding this to your functions.php:

    add_filter('relevanssi_pre_excerpt_content', 'strip_shortcodes_from_excerpts');
    function strip_shortcodes_from_excerpts($content) {
         return strip_shortcodes($content);
    }

    This should do the trick.

    Thread Starter bmckray

    (@bmckray)

    I don’t think I’m doing it right. It broke the theme. I added it to the bottom of the functions.php file in the theme folder and when I reloaded the page I got an error and it wouldn’t pull up. Did it put it in the wrong place?

    Plugin Author Mikko Saari

    (@msaari)

    That is the right place. What error did you get?

    Thread Starter bmckray

    (@bmckray)

    No crash now. Not sure what I did earlier.
    However, it still didn’t strip the shortcodes.

    Plugin Author Mikko Saari

    (@msaari)

    You might’ve tried to reload the page before the upload finished. That can cause errors.

    If that doesn’t help, then… I’m not sure. I’m guessing maybe those shortcodes aren’t actually being defined when Relevanssi does the excerpts. So, instead of using strip_shortcodes(), you might want to try manually removing everything that looks like a shortcode.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘strip shortcodes’ is closed to new replies.