acf_revisions::wp_restore_post_revision()
wp_restore_post_revision
This action will copy and paste the metadata from a revision to the post
Метод класса: acf_revisions{}
Хуков нет.
Возвращает
$revision_id
. (int) the source post
Использование
$acf_revisions = new acf_revisions(); $acf_revisions->wp_restore_post_revision( $post_id, $revision_id );
- $post_id (обязательный)
- -
- $revision_id (обязательный)
- -
Код acf_revisions::wp_restore_post_revision() acf revisions::wp restore post revision ACF 6.0.4
function wp_restore_post_revision( $post_id, $revision_id ) { // copy postmeta from revision to post (restore from revision) acf_copy_postmeta( $revision_id, $post_id ); // Make sure the latest revision is also updated to match the new $post data // get latest revision $revision = acf_get_post_latest_revision( $post_id ); // save if ( $revision ) { // copy postmeta from revision to latest revision (potentialy may be the same, but most likely are different) acf_copy_postmeta( $revision_id, $revision->ID ); } }