Passing variable from URL to script tag
-
I am stumped on how to accomplish something within the WP framework… I am running 4.6.1 with the Divi theme (if that makes a difference).
What I need to do: capture a URL parameter, then pass that parameter in a “<script>” tag. I have tried using a URL parameter plugin which will capture the parameter but seems to have trouble within the script tag. I have also tried a couple of PHP code plugins but they don’t seem to work either.
Pre-WordPress, I have been doing this by using the PHP GET function in the “<head>” section of my PHP page, then storing to a variable, then echoing the variable within the script tag.
I just need a workable solution to do this from within a WP page. Thanks for any input.
The topic ‘Passing variable from URL to script tag’ is closed to new replies.