ParserBlockingScriptTag
The script_tag
filter emits a parser-blocking script tag.
Use an <script src="..." defer>
or <script src="..." async>
element instead.
Learn more about improving your theme's performance.
The following examples contain code snippets that either fail or pass this check.
The script_tag
filter in the following example outputs a parser-blocking script:
The following example uses the asset_url
filter with a defer
attribute on the HTML script tag:
The following example uses the asset_url
filter with a async
attribute on the HTML script tag:
Disabling this check
Anchor link to section titled "Disabling this check"If you can't avoid violating the rule, you should disable the check using the comment syntax. This ensures that you intentionally disable the check for each instance.
Disabling this check isn't recommended.