Available since: 2.9
searchwp_engine_content_type_label
View Parameters »SearchWP recognizes that native content attributes (e.g. Excerpts, Comments, etc) are sometimes repurposed to better suit their context. For example, WooCommerce uses Comments for Product Reviews. Using this hook you can customize the attribute label to match its intended purpose.
Example: if you’re using Excerpts as Abstracts when writing Posts, add the following to your theme’s functions.php
to have SearchWP use “Abstract” instead of “Excerpt” as the label:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Customize the 'Excerpt' label for Posts in SearchWP's engine configuration | |
add_filter( 'searchwp_engine_content_type_label', function( $label, $context ) { | |
if ( 'post' === $context['post_type'] && 'excerpt' === $context['supports'] ) { | |
$label = 'Abstract'; | |
} | |
return $label; | |
}, 10, 2 ); |
Parameters
Parameter | Type | Description |
---|---|---|
$label |
String |
The label for the content type |
$context |
Array |
Contains |