From 41d87c05f211d916a4e243e74f1eeb3bb54a8ce1 Mon Sep 17 00:00:00 2001 From: Ella Date: Mon, 24 Jul 2023 11:37:49 +0100 Subject: [PATCH] Footnotes: fix PHP unit failures for revision handling --- packages/block-library/src/footnotes/index.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/footnotes/index.php b/packages/block-library/src/footnotes/index.php index ca9aca60abfb67..76648b37481a7e 100644 --- a/packages/block-library/src/footnotes/index.php +++ b/packages/block-library/src/footnotes/index.php @@ -142,11 +142,10 @@ static function( $post ) { if ( $_gutenberg_revision_id ) { $revision = get_post( $_gutenberg_revision_id ); - $post_id = $revision->post_parent; // Just making sure we're updating the right revision. - if ( $post->ID === $post_id ) { - $footnotes = get_post_meta( $post_id, 'footnotes', true ); + if ( $revision->post_parent && $post->ID === $revision->post_parent ) { + $footnotes = get_post_meta( $post->ID, 'footnotes', true ); if ( $footnotes ) { // Can't use update_post_meta() because it doesn't allow revisions.