Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created June 2, 2017 13:24
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 joshfeck/9a38f938e940d7c36656320a04e7ff37 to your computer and use it in GitHub Desktop.
Save joshfeck/9a38f938e940d7c36656320a04e7ff37 to your computer and use it in GitHub Desktop.
Adds post meta value to the event search on Event Espresso events admin list table. **Note:** The query will be slower!
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter('FHEE__Events_Admin_Page__get_events__where', 'my_custom_search_field', 10, 2);
function my_custom_search_field( $where, $data ) {
if (isset($data['s'])) {
$search_string = '%' . $data['s'] . '%';
$where['OR']['Post_Meta.meta_value'] = array('LIKE', $search_string);
}
return $where;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment