Is there a ‘best practice’ way of using wp_enqueue_script
on a per page basis? Say I have a donate page using stripe, I don’t really want to load stripe’s js on every single page, just the donate page. I thought the controller would be a good place to do this, but not sure how? My only other idea is to do it in the setup.php
file, below where the main.js
file is being queued up, but wasn’t sure if there was a better way.
Hey @Andrew_Scofield - I would do it in setup.php
where the other scripts are being enqueued, and just check if the relevant page is being loaded to conditionally add the Stripe script.
1 Like
Cool thanks! Was just making sure I was doing that in a standard way.
1 Like