Skip to content

Commit

Permalink
Revert "Remove remaining hooks from footnotes that are causing issues"
Browse files Browse the repository at this point in the history
This reverts commit 9d2f120.
  • Loading branch information
adamsilverstein committed Sep 28, 2023
1 parent 9d2f120 commit 1109df2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
6 changes: 0 additions & 6 deletions lib/compat/plugin/footnotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
}
10 changes: 2 additions & 8 deletions packages/block-library/src/footnotes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 1109df2

Please sign in to comment.