Home › Forums › Front-end Issues › query based on current page › Reply To: query based on current page
Is it outputting anything at all? Like a empty list?
What do you get if you output the results of the query
<?php
$business_event = get_posts(array(
'post_type' => 'event',
'orderby' => array(
'event_date' => 'ASC',
'time_start' => 'ASC'
),
'meta_query' => array(
array(
'key' => 'business_name', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
)
));
// show results of above.
echo '</pre>'; print_r($business_event); echo '</pre>';
?>
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.