Repository navigation
Fix _doing_it_wrong notice from admin notice script on WP 6.9+ block editor - #864
Open
smoen-godaddy wants to merge 1 commit into
Open
smoen-godaddy wants to merge 1 commit into
smoen-godaddy wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a
_doing_it_wrongnotice fired bySV_WC_Admin_Notice_Handler::render_admin_notice_js()on every block editor screen in WP 6.9+, caused by an inline-script timing conflict with WordPress's new iframed editor asset collector.Story: MWC-20359
Release:
Details
WP 6.9+ introduced
_wp_get_iframed_editor_assets(), which callswp_print_footer_scripts()during block editor initialization — beforeadmin_footerfires — incrementing the globaldid_action('wp_print_footer_scripts')counter. Whenrender_admin_notice_js()subsequently runs atadmin_footer:20,ScriptHelper::addInlineScript()sees the counter already elevated and triggers_doing_it_wrong.The fix guards the call with
did_action('wp_print_footer_scripts'): if it has already fired, the script is output directly viawp_print_inline_script_tag()(available since WP 6.0) instead of routing throughScriptHelper.This affects all framework-based plugins on WP 6.9+, not just Memberships — companion fix in the
woocommerce-membershipsrepo (MWC-20359) applies the same guard to a plugin-specific override.UI Changes
None.
QA
Setup
WP_DEBUGenabledSteps
_doing_it_wrongnotice referencingScriptHelper::addInlineScriptappears indebug.logBefore merge