SearchWP

This Documentation is for SearchWP Version 3

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 );
view raw gistfile1.php hosted with ❤ by GitHub

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 post_content or custom_field)

$meta_key Boolean|String

The meta_key (if the $content_type being processed is a custom_field)

[wpforms id="3080"]