Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created July 25, 2017 21:05
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 tripflex/45c1097ca991abb100e8ff8247820801 to your computer and use it in GitHub Desktop.
Save tripflex/45c1097ca991abb100e8ff8247820801 to your computer and use it in GitHub Desktop.
WP Job Manager search all meta keys in keyword search box (or add your own meta keys to search)
<?php
// ^ there should ONLY be one of these at the top of your functions.php file
add_filter( 'job_listing_searchable_meta_keys', 'smyles_allow_search_all_meta' );
function smyles_allow_search_all_meta( $meta_keys ) {
// Below is the default array of meta keys that will be passed
// to search. You can either add your own to the array, or return
// false to force WP Job Manager to search all meta keys
//
// $meta_keys = array(
// '_job_location',
// '_company_name',
// '_application',
// '_company_name',
// '_company_tagline',
// '_company_website',
// '_company_twitter',
//);
// We can return FALSE to force to search all meta keys:
$meta_keys = false;
// You can also add your own meta keys to search like this (just uncomment line below, and comment out or remove line above):
// $meta_keys[] = '_my_meta_key1';
// $meta_keys[] = '_my_meta_key2';
return $meta_keys;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment