Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Modify what tag attributes SearchWP considers valuable when indexing
function my_searchwp_indexer_tag_attributes( $tags ) {
// do not index img tags at all
if ( isset( $tags['img'] ) ) {
unset( $tags['img'] );
// index our custom Reference data attribute on <article>s
$tags['article'] = array( 'data-reference' );
return $tags;
add_filter( 'searchwp_indexer_tag_attributes', 'my_searchwp_indexer_tag_attributes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment