Hello guys,
I am trying to achieve something – which I guess is probably pretty simply or have been covered already. Unfortunately I do not really know for what to search, so it would be great to receive some help from you guys.
I have a custom post type with the name „test“. This custom post type has a custom field with a multiple select field „multiple“ – this field contains two possible values „value1“ and „value2“.
Now I have a common page where I want to alphabetically(!) list the title of all(!) articles of the custom post type „test“ which have the value „value1“ selected.
My question: how to achieve this?! 🙂
Really looking forward to your help and answers!
Best,
Florian
Hi @w-f,
Thanks for the post.
In this use cases, you will only need to create a custom query using the get_posts() function and filter the returned posts using a meta_query by passing the name and value of the custom field.
This is already covered in the following tutorial: https://www.advancedcustomfields.com/resources/query-posts-custom-fields/