I’ll keep it short.
I have a WordPress page and need to redirect users to another URL after 4 seconds. This URL is a query parameter.
Here is an example.
They land on my page with this URL:
The wj_lead_unique_link_live_room is the parameter.
And in this instance, they need to be redirected to this URL after 4 seconds: https://event.webinarjam.com/go/live/15/mqx6vt5coriq3rforg
I need to do this in HTML and JavaScript, which I can embed to the WordPress page in Elementor… tried to do it many different ways, but I could not figure out how to first get the URL parameter.
Thank y’all!
2
Answers
You can check if the parameter is set using URLSearchParams, and if the parameter exists, then add a timeout that redirects after 4 seconds to the given target.
You can use URLSearchParams for search params in the URL. check the code below. code will go to the active theme functions.php file.