Support

Account

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.