Forums › Forums › Search & Filter Pro › Post Meta – filter IDs
Tagged: post meta
- This topic has 6 replies, 3 voices, and was last updated 6 years, 11 months ago by Anonymous.
-
Anonymous(Private) December 12, 2017 at 4:09 pm #147002
Hello,
I’m creating a form to allow filter/search on some post meta information. However, a lot of this meta data is ID’s rather than ‘pretty names’. Can I filter the post meta before it’s displayed in the form and convert it?
Could you point me in the right direction for doing this?
Thanks,
StephAnonymous(Private) December 12, 2017 at 7:02 pm #147040Hello,
No, they’re created with CMB2 so using WordPress native functionality for post meta. I’m storing an ID of a term within a taxonomy (just stored as text), so need to be able to perform my get_term_meta on output of the list of IDs.
Steph
Trevor(Private) December 13, 2017 at 1:29 pm #147173The only way I can think to do this is to manually add the values to the form and then add/correct the labels. Like this:
https://screenshots.firefox.com/aCQ946IoP7OKGsQy/sandfdev.cdnwebservices.net
Ross Moderator(Private) December 13, 2017 at 1:51 pm #147182Hi Steph
Just to add, you can actually update the labels programmatically:
You could use the value of the option to lookup the label, and set that as your label for your option in your field.
Check the linked github example too for more in depth usage.
Hope that helps
-
AuthorPosts