Possible conflict between Yoast and uua-staffer shortcode: Cannot modify header information

By Chris W. Jordan
September 17, 2018, 9:36 am EDT

If I edit a page with a uua-staffer shortcode on it, I get a white screen when I hit “update”. If I turn on error logging I get an error like:

[11-Jun-2018 17:48:25 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/uufec/public_html/wordpress/wp-content/themes/uua-congregation/lib/shortcodes/uua-staffer.php:47) in /home/uufec/public_html/wordpress/wp-admin/post.php on line 198
[11-Jun-2018 17:48:25 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/uufec/public_html/wordpress/wp-content/themes/uua-congregation/lib/shortcodes/uua-staffer.php:47) in /home/uufec/public_html/wordpress/wp-includes/pluggable.php on line 1216

The page itself displays fine, the problem only occurs when I edit the page.

If I disable the Yoast plugin (version 7.6.1) then the error doesn’t occur. In my development environment if I turn on output buffering in my PHP configuration then the problem also doesn’t occur, although annoyingly that doesn’t help in my production environment (which is a bit different, fastCGI instead of mod_php for example). I suspect that since Yoast and uua-staffer.php are both using ob_start that they are getting in each others way a bit. Anyway I’ve turned off Yoast for now, since I’m not really using it for much.