Home › Forums › Front-end Issues › How to search ACF Post Object Type Field › Reply To: How to search ACF Post Object Type Field
There isn’t any way to search a post object field by text that is located in the related post object. The post object field stores the post ID, or an array of post IDS for the related posts.
If you want to be able to search content of the related post and return the post it is related to, then you will also need to store that data in custom fields of the posts that you want returned. That probably sounds confusing, because it is.
Let’s say for example that you want to search all of the post titles of posts in the post object field.
The first thing that you need to do is to store that information in the same post with the post object field.
Please read the following article. This article deals with making a repeater field queryable, however, the same principles apply. You need to get the titles of the posts and store them in a way that they become usable in WP_Query(). https://acfextras.com/dont-query-repeaters/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.