Skip to content

Fix WP 7.0 notice: replace defer arg with strategy => defer in wp_register_script#361

Merged
kraftbj merged 7 commits intoWordPress:trunkfrom
meravi:wp-7-compat-script-strategy
Mar 26, 2026
Merged

Fix WP 7.0 notice: replace defer arg with strategy => defer in wp_register_script#361
kraftbj merged 7 commits intoWordPress:trunkfrom
meravi:wp-7-compat-script-strategy

Conversation

@meravi
Copy link
Copy Markdown
Contributor

@meravi meravi commented Feb 20, 2026

…ister_script

Tested plugin with WordPress 7.0 Beta 1 and WP_DEBUG enabled.

Notice appears:
wp_register_script called incorrectly. Unrecognized key "defer".

Suggested fix:
Replace 'defer' => true with:
'strategy' => 'defer'

This resolves the notice in WP 7.0 beta.

…ister_script

Tested plugin with WordPress 7.0 Beta 1 and WP_DEBUG enabled.

Notice appears:
wp_register_script called incorrectly. Unrecognized key "defer".

Suggested fix:
Replace 'defer' => true with:
'strategy' => 'defer'

This resolves the notice in WP 7.0 beta.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 20, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props ravikhadka, kraftbj.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@kraftbj kraftbj self-requested a review March 26, 2026 16:44
@kraftbj kraftbj merged commit 9becdab into WordPress:trunk Mar 26, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants