• I tried almost all tutorials i found on this but none of them work for me. my search results its showing this:

    [/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_single_image image=”17107″ img_size=”718×500″ alignment=”center” onclick=”img_link_large” img_link_target=”_blank”][vc_column_text] Local Stone Fabricator Shop [/vc_column_text][vc_column_text] Courtesy – Shutterstock [/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_single_image image=”17106″ img_size=”full” alignment=”center” onclick=”img_link_large” img_link_target=”_blank”][vc_column_text] Local Wood Fabricator Shop [/vc_column_text][vc_column_text]

    Right now i have this code in functions.php

    add_filter('relevanssi_pre_excerpt_content', 'rlv_trim_vc_shortcodes');
    function rlv_trim_vc_shortcodes($content) {
        $content = preg_replace('/\[\/?vc.*?\]/', '', $content);
        $content = preg_replace('/\[\/?mk.*?\]/', '', $content);
        return $content;
    }

    This shortcodes stop showing if i turn off this feature in relevanssi -> Custom excerpts/snippets

    Visual studio -> Version 5.1.1

    Am i doing anything wrong ?

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

    (@msaari)

    That’s the code to solve the issue, but if it doesn’t, try this:

    add_filter('relevanssi_pre_excerpt_content', 'rlv_shortcode_blaster');
    function rlv_shortcode_blaster($content) {
    	$content = preg_replace('/\[.*?\]/s', '', $content);
    	return $content;
    }

    That should get rid of all shortcodes. If nothing happens with this function, then you need to check that the function is actually running.

    Thread Starter sahilmoldharia

    (@sahilmoldharia)

    @msaari I tried this too earlier and now too but still shortcodes are in my search. How do i check if the function in running ?

    Thanks.

    Plugin Author Mikko Saari

    (@msaari)

    Change the code to this:

    add_filter('relevanssi_pre_excerpt_content', 'rlv_shortcode_blaster');
    function rlv_shortcode_blaster($content) {
    	$content = preg_replace('/\[.*?\]/s', '', $content);
    var_dump($content);
    exit();
    	return $content;
    }

    Does something happen?

    Thread Starter sahilmoldharia

    (@sahilmoldharia)

    Nop. Still same And i did checked that functions.php and its running.

    [/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_single_image image=”18162″ img_size=”full” alignment=”center” onclick=”img_link_large” img_link_target=”_blank”][vc_column_text] Granite Countertop [/vc_column_text][/vc_column][vc_column width=”1/2″][vc_single_image image=”18163″ img_size=”full” alignment=”center” onclick=”img_link_large” img_link_target=”_blank”][vc_column_text] Granite Steps [/vc_column_text][vc_column_text] Courtesy – Pixabay [/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_single_image image=”18164″ img_size=”450×300″ alignment=”center”…

    Plugin Author Mikko Saari

    (@msaari)

    In that case there’s something unusual going on – if the content passes through that filter, it should definitely remove all text within brackets, no questions asked. So either the content is not really passing through the filter, or something else is interfering.

    Can’t tell what it is, at least not without taking a closer look at this – and that is something I can only do for Relevanssi Premium customers.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Visual Composer Shortcodes in Search Results’ is closed to new replies.