Reputation: 33
I m facing a problem while implementing my captcha code on the wp-login.php. I want to redirect on wp-admin page of my website when the captcha code maches. Is there a way to redirect on wp-admin page?? my code is :
function captcha_login_check($url) {
if (isset($_POST["security_check"]))
{
$code = str_decrypt($_POST["security_check"]);
if (!( $code == $_POST['security_code'] && !empty($code) ))
{
wp_clear_auth_cookie();
return $_SERVER["REQUEST_URI"];
?>
<span style="color:red">
Error, the Security Code does not match. Please Try Again.
</span>
<br>
<?php
}
else
{
$url = $_SERVER['HTTP_HOST']."/wp-admin/";
return $url;
}
}
}
Upvotes: 0
Views: 211
Reputation: 2764
Use like
else
{
$url = $_SERVER['HTTP_HOST']."/wp-admin/";
header('Location:'.$url);
}
Also You can use this
else
{
$url = $_SERVER['HTTP_HOST']."/wp-admin/";
echo ("<script>location.href='$url'</script>");
}
Upvotes: 2