Resolved: A PHP Session was Created by a session_start() Function Call

If your WP health check shows the following error,

A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.

Then resolve by adding the code below to your theme functions (navigate to WP Dashboard > Appearance > Theme editor then select theme functions).

The code

if (!isset($_SESSION)) {

session_start(['read_and_close' => true]);


Save changes.

Enjoyed this article? Stay informed by joining our newsletter!


You must be logged in to post a comment.

Related Articles

Leveraging the power of tech to influence human behavior through positive vibes. Get paid to write about tech, science and more.