peterwilsoncc/rapid-canonical-urls

Have you considered using wp_localize_script?

BronsonQuick opened this issue · 2 comments

When I want to access php variables in JavaScript I usually use wp_localize_script. Did you consider doing this for that section?

It looks to require an enqueued script which I'm trying to avoid.

It's such a small amount of JavaScript, an extra request would slow the site down.

Yeah you're correct that it'll add another request. I always use it as it's generally considered best practice but as you said it's only a small amount of JS in this case. I just thought I'd raise it as a question 😄