danielpowney / my-chatbot

A artificial intelligent chatbot for WordPress powered by Dialogflow (formerly API.AI)
https://danielpowney.com/my-chatbot-demo
GNU General Public License v2.0
76 stars 37 forks source link

Headers already sent - Issue and Fix (Theme related) #13

Closed boegi closed 7 years ago

boegi commented 7 years ago

With the last version I got an Error... Warning: Cannot modify header information - headers already sent by (output started at /www/htd...ad/wp-content/themes/magxp-by-mythemeshop/header.php:1) in /www/htd...ad/wp-content/plugins/my-chatbot/includes/scripts.php on line 42

I fixed it with the following change in the file script.php (Of the Plugin)

New: add_action( 'send_headers', 'myc_load_scripts' ); Old: //add_action( 'wp_enqueue_scripts', 'myc_load_scripts' );

I'm not deep in Web/WP coding so please check again, if this is the right way to call the function with a cookie. For me it worked.

BTW. Thanks for the wonderful Plugin!

danielpowney commented 7 years ago

Thanks for this. I'll need to move where the cookie is set so that it happens before the HTML appears.

danielpowney commented 7 years ago

Fixed. Please find changes in develop branch for v0.5 updates. https://github.com/danielpowney/my-chatbot/commit/524447f828f3b2a4ee5d7500753ad9bc7465296f

boegi commented 7 years ago

Perfect... Wonderful Plugin... But I already told you ;-)

Thanks and have a nice weekend!