headers already sent in …
-
This is really neat. Thank you @colinleroy!
Only one warning reappears sometimes.
PHP Warning: Cannot modify header information - headers already sent in .../plugins/native-gettext/classes/class-native-mo.php on line 119
And right now I’m not able to reproduce triggering this warning. Unlikely.
So I thought about, what could be the reason, had a look into line 119 and so on and came up with:
add_filter( 'override_load_textdomain', array( $this, 'nltd_load_textdomain_override' ), 0, 3 );
Because all of the plugins logic happens inside the running filter hook, we’re not allowed to output anything here, even
headers
. But what if you use wp_headers instead?I tested it replacing your existing line 119 by the following lines, what – indeed – is an ugly hack, but worked.
add_filter( 'wp_headers', function ( array $headers ) : array { $headers[] = "X-Native-Gettext: 1"; return $headers; } );
What do you think?
- The topic ‘headers already sent in …’ is closed to new replies.