{"id":15670951,"date":"2022-05-23T16:30:40","date_gmt":"2022-05-23T16:30:40","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/register-session-error\/"},"modified":"2022-05-23T16:42:12","modified_gmt":"2022-05-23T16:42:12","slug":"register-session-error","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/register-session-error\/","title":{"rendered":"Register Session Error"},"content":{"rendered":"<p>Hi, I tumbled over an error message caused by the Podigee Plugin. <\/p>\n<blockquote><p>PHP Warning:  session_start(): Session cannot be started after headers have already been sent in \/wp-content\/plugins\/podigee\/podigee-quick-publish.php on line 320<\/p><\/blockquote>\n<p>So checking <code>headers_sent()<\/code> turns out that the header was already created and has the following output:<\/p>\n<pre><code># if(headers_sent()) error_log(json_encode(headers_list()));\n[&quot;Expires: Wed, 11 Jan 1984 05:00:00 GMT&quot;,&quot;Cache-Control: no-cache, must-revalidate, max-age=0&quot;,&quot;Content-type: text\\\/html; charset=UTF-8&quot;]<\/code><\/pre>\n<p>If this comes from the wp-core there are only two sources, <code>wp-cron.php:24<\/code> and <code>ajax-action.php:184<\/code>. I&#8217;m not sure why wp writs already the header during the init process.<\/p>\n<p>I see tree possible solution, <\/p>\n<ol>\n<li>check if the header is already written <code>headers_sent()<\/code>,\n<li>on init register_session earlier <code>add_action(&#039;init&#039;, &#039;register_session&#039;, 9); \/\/ default 10<\/code>\n<li>or you just start the session if the requested URI doesn&#8217;t contain wp-cron.php\n<\/ol>\n<p>Does anybody else has this error? <\/p>\n<p>Regards Valentin<\/p>\n","protected":false},"template":"","class_list":["post-15670951","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15670951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":2,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15670951\/revisions"}],"predecessor-version":[{"id":15670961,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15670951\/revisions\/15670961"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15670951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}