Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wp_redirect() function is not working in WP admin

I will try following code for redirect in wordpress admin.

if(isset($_POST['submit'])) 
    {
wp_redirect('admin.php?page=job-creation');
}

i also try wp_redirect('admin.php?page=job-creation'); instead of

wp_safe_redirect('admin.php?page=job-creation'); 

and

header('location: admin.php?page=job-creation');

All codes are working fine in localhost. but it does not working in online(www.example.com).

Help me anyone.

like image 419
Boopathi Rajan Avatar asked Aug 28 '14 06:08

Boopathi Rajan


1 Answers

I think this is for your web server configuration, you can't use header function every where in code. Instead of using header, use this :

print('<script>window.location.href="admin.php?page=job-creation"</script>');

This is a simple javascript code for redirect to another page.

UPDATE

For more information about using header visit this question

like image 158
Saman Gholami Avatar answered Oct 04 '22 14:10

Saman Gholami