SearchWP

This Documentation is for SearchWP Version 3

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:

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

Parameters

Parameter Type Description
$label String

The label for the content type

$context Array

Contains post_type and supports keys

[wpforms id="3080"]