'shop_coupon', 'post_status' => 'publish', ); $query = new WP_Query( $query_args ); foreach ( $query->posts as $post ) { if ( ! empty( $post ) ) { $coupons[ $post->ID ] = array( 'label' => $post->post_title, 'id' => $post->ID, ); } } return $coupons; } public static function get_id() { return 'coupon_used'; } public static function get_supported_filters() { return array( 'autocomplete' ); } public static function is_ajax_field() { return true; } public static function get_validators() { return array( 'required' ); } }