Home › Forums › Backend Issues (wp-admin) › Cannot Query By Custom Field › Reply To: Cannot Query By Custom Field
$args = array(
'post_type' => 'shop_order',
'post_status' => 'any',
'posts_per_page' => -1,
'meta_key' => 'recurring',
'meta_value' => 1
);
// query
$recurring= new WP_Query($args);
if ($recurring->have_posts()) {
$recurring->the_post();
// code to show what you want from these posts
wp_reset_postdata();
}
see the WP_Query examples here https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
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.