• Resolved hollistergj

    (@hollistergj)


    I am using the wpbakery and gravity forms. I’m running into a situation with relevanssi where I am getting matches on form fields and a search element both of which are are on all pages using a wpbakery template shortcode.
    Is there a way to exclude a shortcode like:
    [templatera id=”123″] and [gravityform id=”1″ title=”false”] and
    [woodmart_ajax_search search_post_type=”any”]

    So when I see the custom excerpts they do not show matches within the content coming from those shortcodes?

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

    (@msaari)

    Yes. You can use this:

    add_filter( 'relevanssi_disabled_shortcodes', 'rlv_disable_shortcodes' );
    add_filter( 'relevanssi_disabled_shortcodes_excerpt', 'rlv_disable_shortcodes' );
    
    function rlv_disable_shortcodes( $shortcodes ) {
      $remove = array( 'templatera', 'gravityform', 'woodmart_ajax_search' );
      return array_merge( $shortcodes, $remove );
    }

    This should get rid of those shortcodes in excerpts (and also in indexing).

    Thread Starter hollistergj

    (@hollistergj)

    Thanks so much Mikko!
    that totally helped. I did go in and adjust one thing to make it work though. the add_filters I switched from “disabled” to “disable” once I made that change it worked perfectly. Thanks!

    add_filter( 'relevanssi_disable_shortcodes', 'rlv_disable_shortcodes' );
    add_filter( 'relevanssi_disable_shortcodes_excerpt', 'rlv_disable_shortcodes' );
    
    function rlv_disable_shortcodes( $shortcodes ) {
      $remove = array( 'templatera', 'gravityform', 'woodmart_ajax_search' );
      return array_merge( $shortcodes, $remove );
    }
    • This reply was modified 2 years, 6 months ago by hollistergj.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘exclude a shortcodes’ is closed to new replies.