Skip to content

fix: add missing $in_footer parameter to wp_enqueue/register_script c…#303

Open
masteradhoc wants to merge 4 commits into
plausible:developfrom
masteradhoc:notinfooter
Open

fix: add missing $in_footer parameter to wp_enqueue/register_script c…#303
masteradhoc wants to merge 4 commits into
plausible:developfrom
masteradhoc:notinfooter

Conversation

@masteradhoc
Copy link
Copy Markdown

What

Adds the missing 5th $in_footer argument to three wp_enqueue_script / wp_register_script calls that were triggering the WordPress.WP.EnqueuedResourceParameters.NotInFooter PHPCS sniff.

Files changed:

  • Assets.php — wp_enqueue_script( 'plausible-affiliate-links', … ) → added true
  • FormSubmit.php — wp_register_script( 'plausible-form-submit-integration', … ) → added true
  • WooCommerce.php — wp_enqueue_script( 'plausible-woocommerce-integration', … ) → added true

Why true (footer) for integration scripts

The main Plausible script (plausible-analytics) already correctly uses apply_filters( 'plausible_load_js_in_footer', false ), defaulting to false (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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@masteradhoc has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 32 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 25f6689b-df4c-40a4-9c2b-481b0fb88f1c

📥 Commits

Reviewing files that changed from the base of the PR and between c2fc480 and fe8f08e.

📒 Files selected for processing (3)
  • src/Assets.php
  • src/Integrations/FormSubmit.php
  • src/Integrations/WooCommerce.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Dan0sz
Copy link
Copy Markdown
Collaborator

Dan0sz commented May 17, 2026

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.)

@masteradhoc
Copy link
Copy Markdown
Author

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