Redirect users
-
Hi all,
I’m building a theme from scratch but I’m stuck as of now. I have a custom page template I’m using to process data. After inserting to the wordpress database, I would like users to be redirected to a page where they can review this data. so here’s the code I’ve tried to use unsuccessfully:
wp_redirect('https://localhost/myproject/?page_id=18&lckvarle='.$this_project_id.'');
Below is the error I get:
Warning: Cannot modify header information – headers already sent by (output started at C:\wamp\www\myproject\wp-includes\nav-menu-template.php:425) in C:\wamp\www\myproject\wp-includes\pluggable.php on line 1121I understand that the position of my wp_redirect, which is at the bottom of the page, is the problem.
When I use the native php headers function below, I get a similar error:
` $link = ‘https://localhost/myproject/?page_id=18&lckvarle=’.$this_project_id.”;
header(‘Location: ‘.$link.”);
exit();
`Kindly help.
Thank you in advance.
- The topic ‘Redirect users’ is closed to new replies.