wordpress - 如果转发器位于组中,如何更新转发器字段
问题描述
我正在尝试这种结构:
组 -> 中继器 -> sub_field
$value = array(
'repeater' => array(
array(
'repeater_field' => (foreach)$names
)
)
);
update_sub_field( $group_name, $value, $post_id );
解决方案
您将转发器作为组字段的子字段并将其作为转发器循环。
如果您需要帖子 ID,则如果您不在帖子之外,请阅读有关update_sub_field的信息。
if( have_rows('group') ):
while( have_rows('group') ) :
the_row();
if( have_rows('repeater') ):
while( have_rows('repeater') ) :
the_row();
$value = update_sub_field('sub_field', "update text");
endwhile;
endif;
endwhile;
endif;
推荐阅读
- python - 如何在python中grep出第一个文件路径
- java - 我关于 xpath 不适用于 Selenium 的问题
- c++ - 在执行其他功能的同时播放动画(LED Matrix 和 Arduino/ESP8266)
- php - Prestashop 1.7 将数量从 INT 更改为 FLOAT
- r - R:如何将递归或迭代函数/映射输出输出到向量中?
- python - 当您有一个带有文件字段的模型对象时,模板中的下载链接
- python - TypeError:必须是 str,而不是 int Python3 问题
- xmlhttprequest - 使用以 -Async for Asp.Net Boilerplate 结尾的任务方法将 2.x 升级到 3.x
- hyperledger-fabric - Hyperledger Fabric 是否存储失败的交易?
- d3.js - D3 - 将 y.domain 更改为以最小数量开始