0

When I enable WP_DEBUG, I am getting the error:

WARNING: wp-admin/admin-header.php:9 - Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/site-url.com/wp-includes/functions.php:3886) require_once('wp-admin/admin-header.php'), header

but it is only happening on wp-admin pages, not on the front end.

I have read about this in support pages like this Codex FAQ page and rather than fiddling with text editors and encoding, I simply downloaded WordPress core from the release archive for the same version that's on my site (version 4.5.5 - I am in the process of debugging before I upgrade), and I replaced my local site's version of functions.php with the functions.php file I freshly downloaded from the release archive. That had no effect.

Line 3886 of functions.php is the 3rd line below (the first if ( ! is_null( $message ) )):

if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
        if ( function_exists( '__' ) ) {
            if ( ! is_null( $message ) )
                trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
            else
                trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
        } else {
            if ( ! is_null( $message ) )
                trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
            else
                trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
        }
    }

How do I resolve / further isolate this error?

1

There's only 2 general places the problem could be: One is the theme and two is the plugins. The actual problem is that there's a deprecated function that's being called.

The header already sent message is just WordPress's way of telling you the backend broke before it could build the frontend.

I suggest you:

  1. disable all your plugins;
  2. install + activate a native theme like Twenty Seventeen;
  3. update all your plugins
  4. activate each plugin one at a time until you experience the error
  5. if the error hasn't reappeared update your theme and reactivate it.

When the error reappears you know which plugin/theme is at fault and it will narrow down your search parameters. Otherwise if after all these steps the error has disappeared, the problem was out-of-date software.

1
  • I followed these steps, but I was getting the headers already sent error with each of the first three plugins I activated on their own. More detail at wordpress.stackexchange.com/q/257275/7313 . So I'm not sure how to isolate that error - let me know if you have any other suggestions. – Mike Eng Feb 23 '17 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.