fix: add missing $in_footer parameter to wp_enqueue/register_script c…#303
fix: add missing $in_footer parameter to wp_enqueue/register_script c…#303masteradhoc wants to merge 4 commits into
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the PR, @masteradhoc! Could you check WP 7.0 compatibility with this, though? I'm pretty sure setting a bool as the 5th param is no longer the correct approach in WP 7 (which is coming out in a few days.) |
|
@Dan0sz fair point. updated it per https://developer.wordpress.org/reference/functions/wp_register_script/#parameters |
What
Adds the missing 5th
$in_footerargument to threewp_enqueue_script/wp_register_scriptcalls that were triggering theWordPress.WP.EnqueuedResourceParameters.NotInFooterPHPCS sniff.Files changed:
wp_enqueue_script( 'plausible-affiliate-links', … )→ addedtruewp_register_script( 'plausible-form-submit-integration', … )→ addedtruewp_enqueue_script( 'plausible-woocommerce-integration', … )→ addedtrueWhy
true(footer) for integration scriptsThe main Plausible script (
plausible-analytics) already correctly usesapply_filters( 'plausible_load_js_in_footer', false ), defaulting tofalse(header). This matches Plausible's official docs, which recommend placing the tracking snippet inside<head>.The three scripts touched here are secondary enhancement scripts — they handle affiliate link cloaking, form submissions, and WooCommerce tracking. They do not need to block page rendering and can safely load in the footer. WordPress correctly handles the dependency chain: if a dependent script requests footer placement and its dependency is in the header, WordPress loads them in that order without issues.
@Dan0sz in case you think we'll have to switch them let me know.