acf_revisions::maybe_save_revision
Copies ACF field data to the latest revision.
Метод класса: acf_revisions{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_revisions = new acf_revisions(); $acf_revisions->maybe_save_revision( $revision_id, $post_id );
- $revision_id(int) (обязательный)
- The ID of the revision that was just created.
- $post_id(int) (обязательный)
- The ID of the post being updated.
Список изменений
| С версии 6.2.6 | Введена. |
Код acf_revisions::maybe_save_revision() acf revisions::maybe save revision ACF 6.4.2
public function maybe_save_revision( $revision_id, $post_id ) {
// We don't have anything to copy over yet.
if ( ! did_action( 'acf/save_post' ) ) {
delete_metadata( 'post', $post_id, '_acf_changed' );
delete_metadata( 'post', $revision_id, '_acf_changed' );
return;
}
// Bail if this is an autosave in Classic Editor, it already has the field values.
if ( acf_maybe_get_POST( '_acf_changed' ) && wp_is_post_autosave( $revision_id ) ) {
return;
}
// Copy the saved meta from the main post to the latest revision.
acf_save_post_revision( $post_id );
}