Question

I have a function that checks if the email address already exists in the database or not.

It's working:

Here's that portion.

->callback(function($val) 
{ 
    return !username_exists($val);
}, 'The username you entered already exists.')
->validate('username');

If the username exists, it will through a message saying "The username you entered already exists". What I want after 3 seconds this message is displayed redirects them to login page.

So I've added this line of code to the existing code:

wp_redirect( 'http://localhost/wordpress/wp-login.php', sleep(3)); exit; 

It does redirect, however I do not see the message anymore. Is there anyway I can display that message and then redirect?

It's a wordpress, so I can't do much in it.

Was it helpful?

Solution

You will need a HTML or JavaScript solution, not a php solution.

Here is an HTML solution:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="3;url=http://localhost/wordpress/wp-login.php"></HEAD>
<body>
...
</body>
</html>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top