Skip to content

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

Open
meravi wants to merge 6 commits intoWordPress:trunkfrom
meravi:wp-7-compat-script-strategy
Open

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

Conversation

@meravi
Copy link

@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

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.

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

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.

1 participant