From 1109df25763c6e65545c37eddae06aa555ea36ce Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Thu, 28 Sep 2023 07:53:57 -0600 Subject: [PATCH] Revert "Remove remaining hooks from footnotes that are causing issues" This reverts commit 9d2f1200f8b9030581e89904dfcf084dfe251d29. --- lib/compat/plugin/footnotes.php | 6 ------ packages/block-library/src/footnotes/index.php | 10 ++-------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/compat/plugin/footnotes.php b/lib/compat/plugin/footnotes.php index 915e554cea7ae..7699f3112560c 100644 --- a/lib/compat/plugin/footnotes.php +++ b/lib/compat/plugin/footnotes.php @@ -34,10 +34,4 @@ if ( has_filter( 'rest_pre_insert_post', '_wp_rest_api_force_autosave_difference' ) ) { remove_filter( 'rest_pre_insert_post', '_wp_rest_api_force_autosave_difference' ); } - if ( has_filter( '_wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision' ) ) { - remove_filter( '_wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision' ); - } - if ( has_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' ) ) { - remove_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' ); - } } diff --git a/packages/block-library/src/footnotes/index.php b/packages/block-library/src/footnotes/index.php index f8b5f6248a4d4..dfe6336b0929d 100644 --- a/packages/block-library/src/footnotes/index.php +++ b/packages/block-library/src/footnotes/index.php @@ -200,7 +200,6 @@ function wp_restore_footnotes_from_revision( $post_id, $revision_id ) { * Adds the footnotes field to the revisions display. * * @since 6.3.0 - * @since 6.4.0 Core added post meta revisions, so this is no longer needed. * * @param array $fields The revision fields. * @return array The revision fields. @@ -209,15 +208,12 @@ function wp_add_footnotes_to_revision( $fields ) { $fields['footnotes'] = __( 'Footnotes' ); return $fields; } -if ( ! function_exists( 'wp_post_revision_meta_keys' ) ) { - add_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' ); -} +add_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' ); /** * Gets the footnotes field from the revision for the revisions screen. * * @since 6.3.0 - * @since 6.4.0 Core added post meta revisions, so this is no longer needed. * * @param string $revision_field The field value, but $revision->$field * (footnotes) does not exist. @@ -228,9 +224,7 @@ function wp_add_footnotes_to_revision( $fields ) { function wp_get_footnotes_from_revision( $revision_field, $field, $revision ) { return get_metadata( 'post', $revision->ID, $field, true ); } -if ( ! function_exists( 'wp_post_revision_meta_keys' ) ) { - add_filter( '_wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision', 10, 3 ); -} +add_filter( '_wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision', 10, 3 ); /** * The REST API autosave endpoint doesn't save meta, so we can use the