Make WordPress Core

Opened 22 months ago

Last modified 18 months ago

#44929 new defect (bug)

Revisions: wp_get_revision_ui_diff only displays existing meta fields of the current post

Reported by: luisarn Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Revisions Keywords:
Focuses: ui, administration Cc:


For reproducing the issue:

  1. Turn on revisions
  2. Create a post
  3. Save
  4. Create a custom field with some value
  5. Save
  6. Delete the custom field
  7. Save
  8. Go to the revision comparison
  9. The field added and deleted won't display in the comparision

After doing some debug I found out that the the foreach loop in the function wp_get_revision_ui_diff in wp-admin\includes\revision.php uses _wp_post_revision_fields( $post ) which only takes into consideration of the custom fields of the actual post.



foreach ( _wp_post_revision_fields( $post ) as $field => $name ) {


$fields_from = array();
$fields_to = array();
if ( $compare_from != null )
	$fields_from = _wp_post_revision_fields( $compare_from );
if ( $compare_to != null )
	$fields_to = _wp_post_revision_fields( $compare_to );
$fields = array_merge( $fields_from, $fields_to, _wp_post_revision_fields( $post ) );

foreach ( $fields as $field => $name ) {

Change History (3)

#1 @mukesh27
22 months ago

  • Component changed from Administration to Revisions

#3 @pento
18 months ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.