SearchWP

This Documentation is for SearchWP Version 3

Available since: 2.3

searchwp_indexer_tag_attributes

View Parameters »

Note: Use of this hook will require a manual reindex

By default SearchWP will parse any HTML it finds in your content in an attempt to extract what it considers useful information that should be included in the index. The defaultĀ attributes for the default tags that are processed include:

Tag Indexed attributes
a title
img alt, src, longdesc, title
input placeholder, value

If you would like to change what tags and attributes SearchWP considers to be useful, add something like the following to your theme’s functions.php:

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

Parameters

Parameter Type Description
$tags Array

Associative array keys with HTML tags considered valuable, each value representing the attributes that should be indexed

[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]