Last active
April 10, 2020 15:33
-
-
Save jchristopher/d110ed1641bc7d97a86e342171b76683 to your computer and use it in GitHub Desktop.
Add a Shortcode to exclude content from SearchWP's index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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