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 an application which has the following structure on the user/frontend side:

usercontroller: generates output
userformhandler: processes user input and redirects back to usercontroller

So, when the user inputs data the following type of URL is called:

http://localhost/wordpress/?page_id=4&ftype=userform&func=edit&noheader=true

In this model, the userformhandler processes the data, saves it and then redirects back to the usercontroller. On the admin side (which calls ftype=adminform) this works fine. On the user side however, I get the following error:

WARNING: CANNOT MODIFY HEADER INFORMATION - HEADERS ALREADY SENT BY 
(OUTPUT STARTED AT /VAR/WWW/HTML//WORDPRESS/WP-INCLUDES/L10N.PHP:156) 
IN /VAR/WWW/HTML/WORDPRESS/WP-INCLUDES/PLUGGABLE.PHP ON LINE 881

The headers are being sent from the search box of the twentyeleven theme. Some investigation leads me to believe that the noheader parameter is only honored in ./wp-admin/admin.php ...

Seeing this, is there any way to do this type of processing on the user side without generating headers, ie: do some processing which does not generate output and redirect back to another controller on the user side?

Greetings/Thanks

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You should be sending your header(s)/processing the request before the template loads.

In fact, a hook was added specifically for this: template_redirect

share|improve this answer
    
Works like a charm, thank you!!! –  user13955 Jul 11 '12 at 12:55
    
@user13955 Please don’t forget to mark this answer as the answer (the checkmark on the left ✔). –  toscho Jul 11 '12 at 15:41

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.