【发布时间】:2016-05-10 22:38:11
【问题描述】:
我似乎在 Wordpress 多站点环境中检索 ACF 转发器字段(在选项页面上)时遇到问题。
(选项页面位于子站点上)
下面是我的代码:
$bids = Array();
$blogs = wp_get_sites();
foreach ($blogs as $blog) {
array_push($bids, $blog['blog_id']);
}
$original_blog_id = get_current_blog_id();
$k = 0;
foreach($bids as $bid) {
switch_to_blog($bid);
// this works
$centre_facebook_link = get_field('centre_facebook_link','option')
// this doesnt
if( have_rows('about_team','option') ) {
while ( have_rows('about_team','option') ) { the_row();
$person_image = get_sub_field('person_image');
$person_full_name = get_sub_field('person_full_name');
break;
}
}
switch_to_blog( $original_blog_id );
}
正如评论中所述,普通字段可以正常工作,但是当我尝试从转发器字段中检索数据时,它只是空了。
【问题讨论】:
标签: php wordpress advanced-custom-fields multisite