doubeizhong5178 2016-02-02 08:13
浏览 86

Wordpress MU中的ACF转发器字段(打开和选项页面)不返回数据

I seem to have a problem retrieving ACF repeater fields (on and options page) within a Wordpress Multisite environment.

(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.

  • 写回答

1条回答 默认 最新

  • doucan8521 2016-02-02 11:17
    关注

    I think you need ACF sync plugin for multisite environment.

    https://wordpress.org/plugins/acf-multisite-sync/

    if it doesn't help check : 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;
    
    评论

报告相同问题?

悬赏问题

  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本