acf_revisions::wp_preview_post_fields()publicACF 5.1.0


This function is used to trick WP into thinking that one of the $post's fields has changed and will allow an autosave to be updated. Fixes an odd bug causing the preview page to render the non autosave post data on every odd attempt

@type    function

{} Это метод класса: acf_revisions{}

Хуков нет.




$acf_revisions = new acf_revisions();
$acf_revisions->wp_preview_post_fields( $fields );
$fields (обязательный)

Список изменений

С версии 5.1.0 Введена.

Код acf_revisions::wp_preview_post_fields() ACF 5.10.2

function wp_preview_post_fields( $fields ) {

	// bail early if not previewing a post
	if ( acf_maybe_get_POST( 'wp-preview' ) !== 'dopreview' ) {
		return $fields;

	// add to fields if ACF has changed
	if ( acf_maybe_get_POST( '_acf_changed' ) ) {

		$fields['_acf_changed'] = 'different than 1';


	// return
	return $fields;