How to not send HTTP headers when querying WP outside of the main instanc
-
Hey all,
I have a website that has a WordPress blog and shows a widget list of recent posts on the main site outside of the blog, usingrequire(...../wp-blog-header.php);
andget_posts();
I’ve been getting a lot of “Cannot modify header information – headers already sent by (output started at ..” PHP error messages, on the pages where we’re loading this list of recent posts. I guess WordPress is editing HTTP headers, which might make sense in the main instance but since output has already begun before we get to the recent posts widget, it doesn’t make sense at all.
I’d like to turn on
output_buffering
to deal with this issue, but whenever I turn it on, the pages with the widget show a 404 (but render perfectly normally). I’m not sure what the cause is, but I’m sure all of this has to do with WordPress sending headers when it doesn’t need to. Is there any way to disable this behavior when I’m outside of the main WP instance?Thanks!
- The topic ‘How to not send HTTP headers when querying WP outside of the main instanc’ is closed to new replies.