Custom Fields
Re-Envisioned
Support MB Frontend Submission Not able to get post_id in config as documented Reply To: Not able to get post_id in config as documented

#9388

Anh Tran
Keymaster

Sorry, the docs is incorrect. The submitted post ID is added separately as the 2nd parameter of the hook. Please change the code to this:

add_action ('rwmb_frontend_after_process','emnsh_rwmb_frontend_after_process', 10, 2);
function emnsh_rwmb_frontend_after_process($config, $post_id) {
    if ($post_id') {
        $name = rwmb_meta('emnsh-name');
        wp_update_post(array(
            'ID' =>  $config['post_id'],
            'post_title'=>$name
        ));
    }
}

I also updated the docs.