• Hi,

    I am suddenly getting a “Cannot modify header information” error message whenever I try to publish or update a post, even though I have not changed anything on the website other than changing the max_input_vars inside the php.ini.

    Of course, I have reversed this change but the “Cannot modify header information” error was not resolved.

    The exact error message is as follows:

    Warning: Cannot modify header information – headers already sent by (output started at /home/geschic8/public_html/wp-includes/functions.php:1476) in /home/geschic8/public_html/wp-admin/post.php on line 198

    Warning: Cannot modify header information – headers already sent by (output started at /home/geschic8/public_html/wp-includes/functions.php:1476) in /home/geschic8/public_html/wp-includes/pluggable.php on line 1216

    I have searched everywhere but only found cases where some plugin was directly mentioned inside the error message. In my case, the error message seems to say there is a problem with the /wp-includes/functions.php but I have not made any changes to the core.. I have also deactivated all recently installed or modified plugins.

    I have also found cases where it was suggested that this is caused by whitespaces or closing php tags inside the files mentioned in the error message.
    I have checked the functions.php, the post.php and the pluggable.php and have found no whitespaces or anything else at the end after the }.

    The post.php has the following code on from line 196 to 199:

    // Session cookie flag that the post was saved
    	if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
    		setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
    	} 

    Line 198 inside post.php is exactly this:
    setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );

    The pluggable.php has the following code on from line 1160 to 1220:

    if ( !function_exists('wp_redirect') ) :
    /**
     * Redirects to another page.
     *
     * Note: wp_redirect() does not exit automatically, and should almost always be
     * followed by a call to <code>exit;</code>:
     *
     *     wp_redirect( $url );
     *     exit;
     *
     * Exiting can also be selectively manipulated by using wp_redirect() as a conditional
     * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_location'} hooks:
     *
     *     if ( wp_redirect( $url ) ) {
     *         exit;
     *     }
     *
     * @since 1.5.1
     *
     * @global bool $is_IIS
     *
     * @param string $location The path to redirect to.
     * @param int    $status   Status code to use.
     * @return bool False if $location is not provided, true otherwise.
     */
    function wp_redirect($location, $status = 302) {
    	global $is_IIS;
    
    	/**
    	 * Filters the redirect location.
    	 *
    	 * @since 2.1.0
    	 *
    	 * @param string $location The path to redirect to.
    	 * @param int    $status   Status code to use.
    	 */
    	$location = apply_filters( 'wp_redirect', $location, $status );
    
    	/**
    	 * Filters the redirect status code.
    	 *
    	 * @since 2.3.0
    	 *
    	 * @param int    $status   Status code to use.
    	 * @param string $location The path to redirect to.
    	 */
    	$status = apply_filters( 'wp_redirect_status', $status, $location );
    
    	if ( ! $location )
    		return false;
    
    	$location = wp_sanitize_redirect($location);
    
    	if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' )
    		status_header($status); // This causes problems on IIS and some FastCGI setups
    
    	header("Location: $location", true, $status);
    
    	return true;
    }
    endif;

    Line 1216 inside pluggable.php is exactly this:
    header("Location: $location", true, $status);

    So, does any of this make sense to you?

    Thanks in advance and best regards,
    Jascha

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sublines

    (@sublines)

    When I try to preview the changes I made to a post, I only get the second error message:

    Warning: Cannot modify header information – headers already sent by (output started at /home/geschic8/public_html/wp-includes/functions.php:1476) in /home/geschic8/public_html/wp-includes/pluggable.php on line 1216

    Any ideas?

    • This reply was modified 6 years, 10 months ago by sublines.
    Thread Starter sublines

    (@sublines)

    I would like to request this topic to be deleted or modified to remove sensitive information.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot modify header information’ is closed to new replies.