acf/save_post 直到手动更新才触发

acf/save_post not triggered until manual update

我正在使用 acf_form 创建一个 post,如下所示:

    <?php acf_form(array(
        'post_id'       => 'new_post',
        'post_title' => true,
        'new_post'      => array(
            'post_type'     => 'books',
            'post_status'   => 'publish'
        ),
        'fields' => array('field_5fb2a66de25ba', 'field_5fb009504f235',), 
        'submit_value'  => 'Create Book',
        'html_submit_button'  => '<input type="submit" value="%s" />',
        'updated_message' => ("Book submitted",)

除了我的 acf/save_post 函数在我手动编辑 post 并更新它之前不会触发外,一切正常。这是我在 acf/save_post 中所做的:

            $key_word = get_field('field_5fb2a66de25ba', $post_id);
            update_post_meta( $post_id, 'rank_math_focus_keyword', $key_word );

这有效,但直到我手动编辑和更新页面。

我不是唯一有这个问题的人。如果我得到答案,我会找到其他人并分享好消息。

干杯,理查德

尤里卡!我所要做的就是更改我的操作的优先级:

add_action('acf/save_post', 'my_acf_save_post', 25);