Hello,
A Bit of Background
I have a website up and running: https://gb4cast.com/
This has a search box just under the menu, which allows to search any GB location and a weather forecast will be produced, using a query function within Javascript.
Main Idea
I would like to set a Primary Location within the person’s profile, so that they can hit “Your Weather” which would be a page would be on the menu, and this allows them to get the weather for their area easily.
I am just lost on how I would go about doing such a thing. Any help would be greatly appreciated.
Regards
Jordan
Setting a variable to be used in a script would usually be done using wp_localize_script() during script registration/enqueuing.
If your script is inline you could simply add the variable and value as part of the script content.