Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #7652

    George Brzozowski

    Looking for some PHP snippet for wordpress plugin (RankMath) that redirect users after spending 5 seconds on the website.
    Basically, RankMath offers the features of link redirect. When user clicks on the link they get auto redicredted immediately. I don’t want to it to happen. I want when users clicks on the redirect link, after that they comes to the website and stay there for ~5m then it auto redirects them to the destination page.
    Any help will be highly appreciated.

    I found this script but i need PHP snippet
    <p>You will be redirected in 3 seconds</p>
    var timer = setTimeout(function() {
    }, 3000);



    You don’t need a PHP snippet. Just copy-paste the SCRIPT you provided and it will redirect if you include it in a wordpress post or page. This is assuming it doesn’t get polluted by wordpress’s tendency to surround lines with P tags. You can always create a shortcode for redirecting. This is such a common task, just search around. For example you can use


    Anna J.

    My recommendation is to contact RankMath developers to ask about their plugin hooks. If there is any available hook for redirection then use it with the PHP code. Otherwise edit the RankMath plugin where the redirection code is and replace that code with the redirection code offered by You can also check by editing Shortcode Redirect plugin what tip or strategy they are using to redirect after few seconds. It won’t be more than 2-3 lines of code.

    setTimeout(function () {
    window.location.href= ‘;; // the redirect goes here

    header( “refresh:5;url=wherever.php” );

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.