Home › Forums › Front-end Issues › No revision when update from front end › Reply To: No revision when update from front end
Hi,
Revisions where also missing for me on frontend posting with ACF.
If it helps, I just test successful to call an ACF function to copy metadata from post to revision.
Perhaps it’s better to add action to ‘save_post’ because _wp_put_post_revision() should not be used by theme or plugin.
add_action('save_post', 'custom_save_post', 20);
function custom_save_post( $post_id ) {
// only on front-end
if( is_admin() ) {
return;
}
$parent_id = wp_is_post_revision( $post_id ); //return False if not a revision, ID of revision's parent otherwise.
if ( $parent_id ) {
acf_copy_postmeta( $parent_id, $post_id ); //This function will copy meta from a post to it's latest revision
}
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.