Skip to content

Commit

Permalink
Ensure headers have not been sent before attempting to set a cookie (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj authored and brbrr committed Dec 25, 2019
1 parent 6d7fdc4 commit baf13c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5614,7 +5614,9 @@ public static function state( $key = null, $value = null, $restate = false ) {
$value = $value[0];
}
$state[ $key ] = $value;
setcookie( "jetpackState[$key]", $value, 0, $path, $domain );
if ( ! headers_sent() ) {
setcookie( "jetpackState[$key]", $value, 0, $path, $domain );
}
}
}

Expand Down

0 comments on commit baf13c5

Please sign in to comment.