Support » Plugin: Relevanssi - A Better Search » Shortcodes in the preview text

  • Hi there!

    We are having an issue with the text preview in the results, as we can see the shortcodes from visual composer I’m guessing ( What can we do about this?

    Costin Stanculet.
    [Online Marketing Specialist]

    The page I need help with: [log in to see the link]

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


    Which version of Relevanssi are you using? Current versions of Relevanssi automatically remove the Visual Composer shortcodes from excerpts. If you’re not using the latest version of Relevanssi, do update the plugin.

    Thread Starter cstanculet


    We’re using the latest version of Relevanssi, but an older version of visual composer (5.4.5). Unfortunately we can’t update the version of this plugin right now. Could this be the problem? Or the “Impreza theme”? I can make a support ticket to the theme creators.


    Plugin Author Mikko Saari


    No, the Visual Composer version shouldn’t matter. Relevanssi should remove all shortcodes that start with [vc. The theme shouldn’t be a problem, either, because those look like Relevanssi-generated excerpts otherwise.

    I tried inserting that text on my test site, and Relevanssi stripped off the shortcodes without issues. That is – it should work, and if it doesn’t, perhaps there’s something interfering with the process. Do you have any custom code that’s related to excerpts?

    Any options to exclude custom shortcodes that do not start with vc?

    Actually I found where you’re doing this and just used the same relevanssi_page_builder_shortcodes filter with an array of all my custom shortcodes.

    Could be nice to add this as a feature though, maybe a field that accepts a comma separated list of shortcode names without the brackets.

    • This reply was modified 3 years, 2 months ago by bowenac.
    • This reply was modified 3 years, 2 months ago by bowenac.

    I need other short codes also exluded (like ICONBOX and the shortcode for the dividers which don’t start with VC). I already had a function in my functions file ( but it doesn’t strip everything. @bowenac Could you share how you added additional shortcodes as an array?

    • This reply was modified 3 years, 1 month ago by skigirl1369.
    Plugin Author Mikko Saari


    add_filter( 'relevanssi_page_builder_shortcodes', 'rlv_remove_extra' );
    function rlv_remove_extra( $array ) {
        $array[] = '/\[\/?my_short_code.*?\]/';
        $array[] = '/\[my_short_code_to_remove_with_content.*?\].*\[\/my_short_code_to_remove_with_content\]/';
        return $array;

    This is a rarely needed feature that requires a bit more than just a list of shortcode names (as in some cases, only removing the shortcodes is enough, but in some cases you also need to remove the shortcode contents). Thus this won’t be an option in Relevanssi settings, but instead the functionality is provided with this filter hook.

    Do I need to change “my_short_code” and “my_short_code_to_remove_with_content” to whatever the code is (such as “iconbox” or other shortcodes that seem to be causing problems)? or is there someplace else where the custom shortcodes need to be specified for the array?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Shortcodes in the preview text’ is closed to new replies.