SearchWP Documentation

インストールガイドを表示したり、ナレッジベースを参照したり、SearchWPの多くのフックについて確認したりできます。

searchwp\source\post\attributes\content

4.0.0以降

投稿コンテンツをインデックスする前にカスタマイズします。

パラメータ

タイプ パラメータ デフォルト 提供開始
文字列 $content インデックス作成する投稿コンテンツ 4.0.0
配列 $args
キー タイプ
投稿 \WP_Post インデックス作成中の投稿
4.0.0

All hooks should be added to your custom SearchWP Customizations Plugin.

インデックス作成中に投稿に追加コンテンツを追加する

<?php
// Add additional content to post during indexing in SearchWP.
add_filter( 'searchwp\source\post\attributes\content', function( $content, $args ) {
if ( 48 !== $args['post']->ID ) {
return $content;
}
// Add 'coffee" to the content for Page 48 so it can be searched.
$content .= ' coffee';
return $content;
}, 20, 2 );

このコードの使用方法