Available since: 2.0
searchwp_do_shortcode
View Parameters »Note: Use of this hook will require a manual reindex
By default SearchWP does not parse Shortcodes during indexing. This is because there may be private content contained within Shortcodes, so this feature is opt-in. If you would like to have SearchWP process your Shortcodes during indexing, add the following to your theme’s functions.php
:
<?php | |
function my_searchwp_do_shortcode( $do_shortcode, $post_being_indexed, $content_being_indexed, $meta_key_being_indexed ) { | |
return true; | |
} | |
add_filter( 'searchwp_do_shortcode', 'my_searchwp_do_shortcode', 10, 4 ); |
You can implement more fine-grained control over which content areas are included in Shortcode processing using the hook parameters.
Parameters
Parameter | Type | Description |
---|---|---|
$do_shortcode |
Boolean |
Whether Shortcodes should be processed |
$post |
Object |
The post object being indexed |
$content_type |
String |
The content type being indexed (will be either |
$meta_key |
Boolean|String |
The |