searchwp\source\post\attributes\meta\{$meta_key}
4.0.0以降
単一のカスタムフィールドがインデックスされる前に、そのカスタムフィールド(postmeta)データを操作します。
すべてのカスタムフィールドについては、searchwp\source\post\attributes\meta\${meta_key} を参照してください。
パラメータ
| タイプ | パラメータ | デフォルト | 提供開始 | ||||||
|---|---|---|---|---|---|---|---|---|---|
| 混合 | $meta_value |
カスタムフィールドの値 | 4.0.0 |
||||||
| 配列 |
$args
|
4.0.0 |
|||||||
例
All hooks should be added to your custom SearchWP Customizations Plugin.
SearchWP でインデックス中に特定のカスタムフィールドに追加コンテンツを挿入します
This file contains hidden or 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 | |
| // Add additional content to a specific Custom Field during indexing in SearchWP. | |
| add_filter( 'searchwp\source\post\attributes\meta\my_custom_field_key', function( $meta_value, $args ) { | |
| // Add 'coffee' to Custom Field value to make it searchable. | |
| return $meta_value[0] . ' coffee'; | |
| }, 20, 2 ); |

