Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add a Shortcode to exclude content from SearchWP's index
<?php
// Add a Shortcode to exclude content from SearchWP's index.
add_shortcode( 'searchwp_no_index', function( $atts, $content = null ) {
// If the indexer is running do not return anything,
// else return the content contained in the Shortcode.
return did_action( 'searchwp\indexer\batch' ) ? '' : $content;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.