Skip to content

Instantly share code, notes, and snippets.

@MarkPraschan
Created January 23, 2019 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkPraschan/9fd11ef3c831292596432ecc36aab02a to your computer and use it in GitHub Desktop.
Save MarkPraschan/9fd11ef3c831292596432ecc36aab02a to your computer and use it in GitHub Desktop.
Strip all post content (like shortcodes) located within [brackets] - Algolia / WordPress / WooCommerce
// STRIP SHORTCODES FROM ALGOLIA SEARCH RESULTS
add_filter( 'algolia_strip_patterns', function( $patterns ) {
$patterns[] = '/\[\/?.*?\]/g';
return $patterns;
} );
@MarkPraschan
Copy link
Author

For use with Algolia for WordPress / WooCommerce. Global-scope on this regex means it will find all instances of post/page content between brackets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment