WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My wordpress plugin uses sessions for handling various things, and on the production site I'm testing it on output buffering is not on by default so I'm getting a lot of messages such as these:

Warning: session_start() [function.session-start]: 
Cannot send session cookie - 
headers already sent by 
(output started at /blah/wp-content/themes/Starkers/header.php:12) 
in /blah/wp-content/plugins/rsq/store.php on line 4

Is there a hook or something I can latch on to in order to turn on output buffering? Am I going about this in entirely the wrong way?

Thanks, John.

share|improve this question
yes you are. Try to find out the actual problem and why the plugin sets cookies after headers have been sent – onetrickpony Apr 25 '12 at 11:39

Although I realise this is probably not the right way to go about it, I managed to turn on output buffering using the following code in my plugin:

add_action('init', 'rsq_buffering');
function rsq_buffering()

I probably should be doing any session stuff from within the init hook instead of just all over the place.

share|improve this answer

Your Answer


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.