-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Footnotes: fix accidental override #53663
Conversation
add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' ); | ||
} | ||
add_action( 'rest_after_insert_post', 'wp_add_footnotes_revisions_to_post_meta' ); | ||
add_action( 'rest_after_insert_page', 'wp_add_footnotes_revisions_to_post_meta' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth noting that we could move this to the register_block_core_footnotes
function, which runs on init
, but I'm scared to move code around at this point. It's an option though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We anyway went for hardcoding these for this release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now; it'll have to change anyway once we add support for other post types so we can leave bigger changes till then 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' ); | ||
} | ||
add_action( 'rest_after_insert_post', 'wp_add_footnotes_revisions_to_post_meta' ); | ||
add_action( 'rest_after_insert_page', 'wp_add_footnotes_revisions_to_post_meta' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now; it'll have to change anyway once we add support for other post types so we can leave bigger changes till then 😄
* Footnotes: fix accidental override * Remove double quotes
* Footnotes: Fix recursion into updating attributes when attributes is not an object (#53257) * Fix crash by moving editor style logic into a hook with useMemo (#53596) * Move editor style logic into a hook whith useMemo * Remove unnecessary useMemo * Move the whole logic inside the 'useMemo' * Add missing useSelect dep --------- Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> * Adding an is_array check before using count in case $footnotes is not countable (#53660) * Footnotes: fix accidental override (#53663) * Footnotes: fix accidental override * Remove double quotes * Footnotes: autosave is not slashing JSON (#53664) * Footnotes: autosave saves decoded JSON * wp_slash * Curly quote * Slash on save and restore * Ensure the preview dropdown popover closes (<16.3) for e2e tests --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Noah Allen <noahtallen@gmail.com> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: ramon <ramonjd@gmail.com>
What?
We're accidentally overriding the $post_type global 🤦♀️
Fixes https://core.trac.wordpress.org/ticket/59105.
Why?
How?
Avoid the foreach loop setting the $post_type global
Alternatively, we could move this to
register_block_core_footnotes
, but I opted for moving as little code as possible.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast