我正在尝试获取与用户关联的团队名称。我已经得到了正确团队的 var_dump 。但价值有 :private
有没有办法让我仍然呼应这个价值?
$user_id = $post->post_author ;
$teamnames = wc_memberships_for_teams_get_teams( $user_id );
foreach( $teamnames as $teamname ) {
echo $teamname->post->post_title;
}
这是 var_dump( $teamname) 的一部分
array(1) {
[0]=>
object(SkyVerge\WooCommerce\Memberships\Teams\Team)#27586 (19) {
["id":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
int(65458)
["name":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
string(17) "Clarkston Primary"
["date":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
string(19) "2019-11-19 10:17:00"
["date_gmt":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
string(19) "2019-11-19 10:17:00"
["owner_id":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
int(4760)
["plan_id":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
int(11576)
["registration_key":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
string(32) "119a2d7697a925a1a65d88ec46b2e951"
["plan":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
NULL
["post":"SkyVerge\WooCommerce\Memberships\Teams\Team":private]=>
object(WP_Post)#27585 (24) {
["ID"]=>
int(65458)
["post_author"]=>
string(4) "4760"
["post_date"]=>
string(19) "2019-11-19 10:17:00"
["post_date_gmt"]=>
string(19) "2019-11-19 10:17:00"
["post_content"]=>
string(0) ""
["post_title"]=>
string(17) "Clarkston Primary"