Can’t create PHP cookie: cannot modify headers information
-
Good day! I’m developing a plugin where you get to see cookie popup. However, I can’t get this because of a certain error which I constantly get: Warning: Cannot modify header information – headers already sent by (output started at /Applications/MAMP/htdocs/projects/cookie_3dynamisch_plugin/wordpress/wp-includes/class.wp-styles.php:290
wp_enqueue_style('style', '/wp-content/plugins/cc3d/includes/css/style.css'); add_action('init', 'create_cookie'); function create_cookie() { echo "Hello world!"; if (!isset($_COOKIE["TestCookie"])) { $value = 'something from somewhere'; setcookie("TestCookie", $value, time() + 3600); wp_enqueue_script('script', '/wp-content/plugins/cc3d/includes/js/cookieconsent.js'); } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Can’t create PHP cookie: cannot modify headers information’ is closed to new replies.