Available since: 3.0
searchwp_meta_groups
View Parameters »SearchWP makes all Custom Fields for post types available when configuring search engines. You can group Custom Fields in any way you’d like using this hook:
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 | |
// Combine some Custom Fields into groups when configuring SearchWP engines. | |
add_filter( 'searchwp_meta_groups', function( $meta_groups, $args ) { | |
// Create a meta group in the SearchWP engine Custom Field dropdown | |
// called 'My Meta Group' with meta_key_1 and meta_key_2 inside. | |
$meta_groups['my_meta_group'] => array( | |
'label' => 'My Meta Group', | |
'metakeys' => array( | |
'my_meta_key_1', | |
'my_meta_key_2', | |
), | |
); | |
return $meta_groups; | |
}, 20, 2 ); |
Parameters
Parameter | Type | Description |
---|---|---|
$meta_groups |
Array |
The existing meta groups. Array of arrays, each with a |
$args |
Array |
|