Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a menu item I created called 'View Certificates' and a sub menu item called 'Add Certificates'. The Add Certificates page is just a file upload page. After the file uploads successfully, I want it to redirect back to the 'View Certificates' page.

All my code is in the functions.php file. How do I go about doing this redirect?

share|improve this question

3 Answers 3

up vote 0 down vote accepted

You can use wp_redirect

<?php 
$url='something.com';
wp_redirect($url); 
exit; 
?>
share|improve this answer
    
im getting errors about not modifying the headers –  dtj Oct 15 '11 at 16:28
    
What is the exact error you get? –  chifliiiii Oct 15 '11 at 18:01
    
Warning: Cannot modify header information - headers already sent by (output started at /wp-admin/admin-header.php:34) in /wp-includes/pluggable.php on line 934 –  dtj Oct 15 '11 at 18:54
    
wp_redirect acts the same as "php header( 'Location:" You can not output any html before you run it. If you ar ein functions.php you should be able to do it. If you form use javascript maybe you can add a callback and do a javscript location.replace="yoursite.com" –  chifliiiii Oct 16 '11 at 0:02

How about standard header( 'Location: http://ViewCertificatesPage' );

http://php.net/manual/en/function.header.php

share|improve this answer

wp_redirect is a function which helps you to redirect http://codex.wordpress.org/Function_Reference/wp_redirect

& you can run it in conditions with http://codex.wordpress.org/Conditional_Tags

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.