Created
May 8, 2014 16:22
-
-
Save ChrisLTD/892eccf385752dadaf5f to your computer and use it in GitHub Desktop.
Fix so you can preview ACF field changes in Wordpress admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Debug preview with custom fields | |
Taken from: http://support.advancedcustomfields.com/forums/topic/preview-solution/ | |
See also: http://support.advancedcustomfields.com/forums/topic/2nd-every-other-post-preview-throws-notice/ | |
*/ | |
add_filter('_wp_post_revision_fields', 'add_field_debug_preview'); | |
function add_field_debug_preview($fields){ | |
$fields["debug_preview"] = "debug_preview"; | |
return $fields; | |
} | |
add_action( 'edit_form_after_title', 'add_input_debug_preview' ); | |
function add_input_debug_preview() { | |
echo '<input type="hidden" name="debug_preview" value="debug_preview">'; | |
} |
Thank you. In 2023 it still works.
This appears to no longer work as of June 2023. WP 6.2.2, ACF Pro 6.1.6. Revisions enabled.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Not having revisions enabled was my issue! I use WP Engine and they disable revisions by default (you have to ask their tech support to enable it). Then you need to enable revisions for each of your post types as well.