Support General rwmb_after_save_post Reply To: rwmb_after_save_post

#13039
Anh TranAnh Tran
Keymaster

Hi Max,

I think the problem is there are multiple meta boxes and the hooks don't fire properly. They fire per meta box, so if there are 2 meta boxes, the hook rwmb_before_save_post might fire before one meta box saving action, but after another meta box saving action.

As Meta Box uses hook save_post_{$post_type} with priority to save the data, please try the replacing the hooks with:

add_action('save_post_{your_post_type}', 'api_get_old_fields', 0);
add_action('save_post_{your_post_type}', 'api_set_new_fields', 20);