最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

hooks - Save acf field data via acfsave_post before post is saved

programmeradmin1浏览0评论

I have 4 advanced custom fields and I would like to save each field value when it is changed on the post and not have to wait until the post is saved.

I'm using acf/save_post action. Here is my code so far:

function my_acf_save_post( $post_id ) { 
    $fields = false; 
    if( isset($_POST['acf']) ) { 
        $fields = $_POST['acf']; 
    } 
}
add_action('acf/save_post', 'my_acf_save_post', 1);
发布评论

评论列表(0)

  1. 暂无评论