Note: You are viewing the documentation for Version 4View Version 3 Docs

searchwp\source\post\attributes\meta\{$meta_key}

Since: 4.0.0

Table of Contents

Manipulate Custom Field (postmeta) data for a single Custom Field before it is indexed.

See also searchwp\source\post\attributes\meta\${meta_key} for all Custom Fields.

Parameters

Type Parameter Default Since
Mixed $meta_value Custom Field value 4.0.0
Array $args
Key Type Value
post_id Integer Post ID
4.0.0

Examples

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

Add additional content to a specific Custom Field during indexing in SearchWP

<?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 . ' coffee';
}, 20, 2 );

How to use this code

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP