删除基于另一个值的ACF值
我希望有人可以协助下面的片段,当更改其他选择字段以完成时,我需要删除我的字段值之一。
add_action('acf/save_post', 'my_acf_save_post');
function my_acf_save_post($post_id){
$status = get_field('status');
if ('complete', $status){
delete_field('project_address');
}
}
I am hoping someone could please assist with the below snippet, I need for one of my fields values to be deleted when a different select field is changed to complete.
add_action('acf/save_post', 'my_acf_save_post');
function my_acf_save_post($post_id){
$status = get_field('status');
if ('complete', $status){
delete_field('project_address');
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要传递“ post_id”以选择值并删除值。我认为逻辑是真的。
希望它有帮助。
You need to pass the "post_id" to select the value and delete the value. Logic it true, I think.
Hope it help.