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

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

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:

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

Parameters

Parameter Type Description
$meta_groups Array

The existing meta groups. Array of arrays, each with a label key for the meta group label and a metakeys key with an array of meta keys to include in the group.

$args Array

$args['post_type'] The post type for this meta group
$args['meta_keys'] The meta keys in this post type

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