[英]ACF repeater fields (on and options page) within a Wordpress MU not returning data
I seem to have a problem retrieving ACF repeater fields (on and options page) within a Wordpress Multisite environment. 我似乎在Wordpress Multisite环境中检索ACF转发器字段(位于和选项页上)时遇到问题。
(the options pages are on the child sites) (选项页面在子网站上)
This is my code below: 这是我的代码如下:
$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 );
}
As noted in the commenting the normal fields work, but the moment I try to retrieve data from the repeater field it just comes up empty. 如注释中所述,正常字段起作用,但是当我尝试从转发器字段检索数据时,它只是空的。
I think you need ACF sync plugin for multisite environment. 我认为您需要用于多站点环境的ACF同步插件。
https://wordpress.org/plugins/acf-multisite-sync/ https://wordpress.org/plugins/acf-multisite-sync/
if it doesn't help check : https://github.com/tmconnect/acf-relationship-multisite 如果没有帮助检查: https : //github.com/tmconnect/acf-relationship-multisite
another way to do it is : 另一种方法是:
switch_to_blog( $current_site );
$GLOBALS['_wp_switched_stack'] = array();
$GLOBALS['switched'] = FALSE;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.