apply_filters( 'relevanssi_disabled_shortcodes', array $shortcodes )

There are shortcodes that do not work well with Relevanssi. These shortcodes can be blocked from the indexing with this filter hook. Relevanssi disables all shortcodes listed with this hook.


(array) An array of shortcode names to disable. For the default values, see below.

More information

When Relevanssi indexes posts, if shortcode expansion is enabled in the Relevanssi indexing settings, Relevanssi removes uncompatible shortcode functions and replaces them with __return_empty_string() to get rid of the shortcodes.

If you want to add a new shortcode to the block list, do this:

  function( $shortcodes ) {
    return array_merge( $shortcodes, array( 'blocked_shortcode', 'another_shortcode' ) );

Relevanssi Premium users can add blocked shortcodes from the Relevanssi indexing settings.

If you only want to disable a shortcode in the excerpt-building – perhaps it works fine in indexing, but messes up excerpts – you can use the relevanssi_disable_shortcodes_excerpt filter hook.

Here’s the default list of blocked shortcodes:

	$default_disables = array(
		'contact-form', // Jetpack Contact Form causes an error message.
		'starrater', // GD Star Rating rater shortcode causes problems.
		'responsive-flipbook', // Responsive Flipbook causes problems.
		'avatar_upload', // WP User Avatar is incompatible.
		'product_categories', // A problematic WooCommerce shortcode.
		'recent_products', // A problematic WooCommerce shortcode.
		'php', // PHP Code for Posts.
		'watupro', // Watu PRO doesn't co-operate.
		'starbox', // Starbox shortcode breaks Relevanssi.
		'cfdb-save-form-post', // Contact Form DB.
		'woocommerce_cart', // WooCommerce.
		'maxmegamenu', // Max Mega Menu.
		'searchandfilter', // Search and Filter.
		'downloads', // Easy Digital Downloads.
		'swpm_protected', // Simple Membership Partially Protected content.
		'gravityform', // Gravity Forms.
		'sdm_latest_downloads', // SDM Simple Download Monitor.
		'slimstat', // Slimstat Analytics.
		'ninja_tables', // Ninja Tables.