-1

I am having this error in a developing plugin.
Works fine in localhost but in the remote server fails with:

Warning: Cannot modify header information - headers already sent by (output started at /path_wordpress/public_html/wp-admin/includes/template.php:1657) in /path_wordpress/public_html/wp-includes/pluggable.php on line 866

I have removed all spaces before and after at the beginning and end of files (the common reason for this error) and there are no sessions involved.

What another reasons could be?

===
EDIT 1

wp-admin/includes/template.php:

$attributes = '';
if ( is_array( $other_attributes ) ) {
    foreach ( $other_attributes as $attribute => $value ) { // line 1657 
        $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
    }
} else if ( !empty( $other_attributes ) ) { // Attributes provided as a string
    $attributes = $other_attributes;
}

===
EDIT 2:

wp-admin/wp-includes/pluggable.php:

if ( !function_exists('wp_redirect') ) :
/**
 * Redirects to another page.
 *
 * @since 1.5.1
 * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
 *
 * @param string $location The path to redirect to
 * @param int $status Status code to use
 * @return bool False if $location is not set
 */ // line 866
function wp_redirect($location, $status = 302) {
    global $is_IIS;
Igor Parra
  • 10,214
  • 10
  • 69
  • 101

1 Answers1

1

Cannot modify header information usually occurs when you try to use header() or redirect function after some html has been outputted. It is unlikely to be inside one of Wordpress native code files, so check some custom code you might have written that tries to redirect the page.

Reference: http://php.net/manual/en/function.header.php

anuragbh
  • 603
  • 1
  • 5
  • 11
  • Thanks, was stuck on this for some time, but you were spot on "Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP" – Bwyss Mar 22 '13 at 20:51