我需要一些帮助从wpdb而不是od数组中获取单个字符串。下面的代码应返回子邮政编码。它将始终返回包含单个元素的数组。
global $wpdb;
$store = wp_get_current_user();
$store_id = $store->ID;
$par_order = $reservation->transaction_id;
$sql = "SELECT ID FROM " . $wpdb->prefix . "posts
WHERE post_type = \'shop_order\'
AND post_parent = " . $par_order
. " AND post_author = " . $storer_id;
$sub_orders = $wpdb->get_results($sql);