Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created January 23, 2015 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/2a403e33a167800b5c75 to your computer and use it in GitHub Desktop.
Save jchristopher/2a403e33a167800b5c75 to your computer and use it in GitHub Desktop.
Modify what tag attributes SearchWP considers valuable when indexing
<?php
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