Extending the search function to a specific meta field value in the admin posts
-
I’d like to transform the following code. This code was done to add a specific search for post ID numbers. Now I need a function to extend the search to a meta field called “function_name”, and the search is not public but from the admin post table
function search_by_post_id($query) { if($query->is_search) { if(is_numeric($query->query_vars['s'])) { $query->set('post_type', 'any'); $query->set('post__in', array((int)$query->query_vars['s'])); $query->set('s', ''); } } return $query; } add_filter('pre_get_posts', 'search_by_post_id');
The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Extending the search function to a specific meta field value in the admin posts’ is closed to new replies.