Posted: May 30, 2017 at 7:48 am
Is there a way to search a custom metabox in the Event Admin List?
|
|
Hi there, This is possible but you’ll need to add the search box to another admin route. So step 1 is you add the following: https://wordpress.stackexchange.com/a/16641 Then you can make the native custom post type route for Event Espresso events visible by adding: https://gist.github.com/joshfeck/fa45f6d23219de88c9679c1397e5fbfa You can add both of the above to a functions plugin. |
|
Thanks for your reply, but can’t I use just the normal Search Field for query the new column value like in the screenshot? Thanks for your help. |
|
The search field queries the DB, the additional column you’d added concatenates an extra meta value from the events category and also event meta together within the column so 2 values. How are you going to query for those concatenated values on a single event? The ‘WHERE’ conditions for the query are filtered so you can change how they are constructed if you can do the above:
Another option you have is to just use the post meta value rather than the concatenated full value. You’ll likely want to take a look at the documentation available here for information on how to query the additional field using our models: https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System |
|
Something like this will get you closer: https://gist.github.com/joshfeck/9a38f938e940d7c36656320a04e7ff37 That said, the above will search for the post meta value. Your column’s content appears to be the combination of a category meta value + a post meta value so the results may vary. |
|
Thank you so much, it worked like a charm. I re coded the metabox to just one value so there is no Problem with the search query. Is there also a filter available for the espresso_registrations page? |
|
Hi there, I checked and there isn’t a filter for the registrations search query. I can encourage you to add a filter to the _add_search_to_where_conditions() method and submit a pull request on the Github repository and the dev team will review: |
|
The support post ‘Filter Event Admin List Search Query’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.