php - 需要重新加载页面以在 Wordpress 中显示 meta_key 的新值
问题描述
我尝试update meta key
使用自定义表单wordpress
内容管理系统:WordPress
插件:高级自定义字段
字段类型:中继器字段
这是 single.php 中的代码
if(isset($_POST['submit'])){
if( have_rows('custom_req') ){
while( have_rows('custom_req') ){ the_row();
$r_req = get_sub_field('req_fie');
if ($_POST['radio-b'] == $r_req ) {
update_sub_field('rq_answer', 'new_value');
}
}
}
}
if( have_rows('custom_req') ){
while( have_rows('custom_req') ){ the_row();
the_sub_field('rq_answer'); // This line shows the previous value
}
}
问题是显示以前的值,必须重新加载页面才能显示新值
这是为什么?我该如何解决这个问题?
谢谢你的帮助
解决方案
推荐阅读
- time-complexity - 自动编码器的顺序复杂度
- python - 禁止和取消禁止仅在没有角色的情况下工作
- ios - flutter in_app_purchase:如何在 iOS 上验证收据?
- pine-script - 如何根据条件为真触发标签,但仅触发一次
- java - 如何知道 java.util.concurrent 未来接口是否仍然有效?
- python - 通过函数添加减法值并将数据附加到 for 循环的列表中
- python - \b 等效于在 python 中保持零宽度的 unicode 正则表达式
- c++ - 致命错误:dcmtk/config/osconfig.h:没有这样的文件或目录
- wordpress - 向每 100 个页面访问者显示不同的内容(wordpress)
- python - 将年份数字转换为 'yyyy-mm-dd' 格式