Hello all,
I have a wordpress site with a certain membership login plugin.

When i have an expired user that logs in i get this message: (this same error repeats itself for about fifteen or so lines for pluggable-line 669, 670, 671...etc
*
Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:243) in /home/xxx/public_html/wp-includes/pluggable.php on line 669*

So i deactivate the All in One Seo Plugin and get the following: (same thing with the repeating pluggable lines)

Warning: Cannot modify header information - headers already sent by (output started at /home/jeep123/public_html/wp-content/themes/mad/header.php:2) in /home/jeep123/public_html/wp-includes/pluggable.php on line 671

This is what the top of my header file looks like:

<?php
/**
 * The Header for our theme.
 *
 * @package WordPress
 * @subpackage blah
 * @since blah
 */
?>
<!doctype html>
<!--[if IE 6]><html class="ie6 oldie" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 7]><html class="ie7 oldie" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]><html class="ie8 oldie" <?php language_attributes(); ?>>
<![endif]-->
<!--[if gte IE 9]><!--><html <?php language_attributes(); ?>><!--<![endif]-->
<head>

And this is what the pluggable lines look like:

    setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
    if ( COOKIEPATH != SITECOOKIEPATH )
        setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
}
endif;

if ( !function_exists('wp_clear_auth_cookie') ) :
/**
 * Removes all of the cookies associated with authentication.
 *
 * @since 2.5
 */
function wp_clear_auth_cookie() {
    do_action('clear_auth_cookie');

    setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
    setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
    setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
    setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
    setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);

    // Old cookies
    setcookie(AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    setcookie(AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
    setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);

    // Even older cookies
    setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
    setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
}
endif;

The plugin developer said this "the eader.php file is basically printing out headers before it should. Some programming issue there. And since WordPress is trying to set cookies through pluggable.php, it was showing all of those errors - every single one of them because of the same issue with your theme header."

And recommended to change all of the 'setcookie' to '@setcookie'

But I'm not a hard core programmer and i believe this is just hiding the errro right? Anyone have a better solution or would this be ok?

if you have an issue with a wp plugin, it's usual to contact the plugin author. Otherwise, every time you update the plugin, any fix you've done yourself will be overwritten.

If you look in the list of plugins in your browser, you will find the author listed, along with either the address of their page or contact details.

@tiggsy is correct that this is something the plug-in author has to fix. Cookies cannot be set once output has begun (this is fixed/changed in the newest versions of PHP) because they must be sent as part of the HTTP headers that get sent at the TOP of the output.

I'm no WordPress developer but I've peeked at the code of some of their plugins and lurked around their developer documentation a bit while building WordPress sites for clients. Those cookies need to be set within some event that occurs before the document starts to render.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.