Skip to content

Instantly share code, notes, and snippets.

@pickplugins
Created June 17, 2021 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pickplugins/d5cb5e5c2c847b12829d0ab7539c8c0e to your computer and use it in GitHub Desktop.
Save pickplugins/d5cb5e5c2c847b12829d0ab7539c8c0e to your computer and use it in GitHub Desktop.
function me_search_query( $query ) {
if ( $query->is_search ) {
$meta_query_args = array(
array(
'key' => 'accordions_options',
'value' => $query->query_vars['s'] = '',
'compare' => 'LIKE',
),
);
$query->set('meta_query', $meta_query_args);
};
}
add_filter( 'pre_get_posts', 'me_search_query');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment