Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
This PR adds the defer attribute to the front end script js/rank-math.js enqueued in includes/frontend/class-frontend.php.
Context
WordPress introduced a new strategy feature in the Script API in version 6.3. See this post for more details. Even though js/rank-math.js is only enqueued when the wp-admin bar is shown, it still seems helpful to leverage defer and switch away from the boolean in_footer setting.
Note that this PR includes a version check and slightly different behavior for 6.3 vs. 6.4 where a potential regression is fixed.
Summary
Detects WordPress version, using new approach when available and falling back to existing approach
This PR adds the
defer
attribute to the front end scriptjs/rank-math.js
enqueued inincludes/frontend/class-frontend.php
.Context
WordPress introduced a new strategy feature in the Script API in version 6.3. See this post for more details. Even though
js/rank-math.js
is only enqueued when the wp-admin bar is shown, it still seems helpful to leveragedefer
and switch away from the booleanin_footer
setting.Note that this PR includes a version check and slightly different behavior for 6.3 vs. 6.4 where a potential regression is fixed.
Summary
Test instructions
data-wp-strategy="defer
indicating the API has added the attribute.