Home › Forums › General Issues › Searching by taxonomy custom field › Reply To: Searching by taxonomy custom field
Solved it. Here is how:
$myrows = $wpdb->get_results( "SELECT * FROM wp_postmeta WHERE meta_key = 'manufacturers' AND meta_value LIKE '%$manufacturer_id%'" );
foreach($myrows as $row){
$retailer_ids[] = $row->post_id;
}
Then run a WP_query with the post ids
$args = array(
'post_type' => 'where',
'post__in' => $retailer_ids
);
$retailers_query = new WP_Query($args);
The only reason I can see this having issues is if one of the serialized pointers is the same as a manufacturer ID. But there are ways to start them high so this workaround should be good for now.
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!
✨ You can now install ACF PRO with Composer, eliminating the need for third-party installers. Get the details and instructions here. https://t.co/ebEfp60Pwj
— Advanced Custom Fields (@wp_acf) February 2, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.