Home › Forums › General Issues › Get a list of posts where a custom field matches with the current ID › Reply To: Get a list of posts where a custom field matches with the current ID
https://www.advancedcustomfields.com/resources/query-posts-custom-fields/ see the section on querying on array based values. Also see this guide https://www.advancedcustomfields.com/resources/querying-relationship-fields/
$args = array(
...
'meta_query' => array(
array(
'key' => '',
'value' => '"'.$idArtist.'"',
'compare' => 'LIKE'
)
)
);
See https://developer.wordpress.org/reference/classes/wp_query/ for more info on properly constructing queries.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.