Headers already sent in REST API endpoint since 5.6x
-
Serving images via a WP REST API endpoint, I came across something that I cannot quite put my finger on. All of a sudden, without any other changes, I’m getting:
[09-Feb-2021 13:59:06 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/html/domain.com/public_html/wp-content/plugins/myplugin/includes/class-my-rest.php:317) in /home/html/domain.com/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1631
I’m sure there’s something I’m doing wrong, but did something change in WordPress Core/REST between 5.4x and 5.6x? Nothing has changed in the code for ‘myplugin’. Looking at the code it points to (in myplugin), I do indeed issue header() calls, followed by ob_start(), echo blablabla, and ob_endflush().
I have checked for possible whitespace in places like functions.php, etc. but haven’t found anything.
- The topic ‘Headers already sent in REST API endpoint since 5.6x’ is closed to new replies.