{"id":7331151,"date":"2016-04-28T22:10:41","date_gmt":"2016-04-28T22:10:41","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/php-issue-get_post-no-longer-working\/"},"modified":"2016-08-31T17:03:41","modified_gmt":"2016-08-31T17:03:41","slug":"php-issue-get_post-no-longer-working","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/php-issue-get_post-no-longer-working\/","title":{"rendered":"PHP Issue &#8211; get_post no longer working"},"content":{"rendered":"<p>I&#8217;m having a strange issue. I have a test static web page that I&#8217;m using get_post to pull my latest blog post onto. Previously, this was working fine. However, I went a couple months without tinkering with the site and when I came back to it, the PHP was no longer working. <\/p>\n<p>In the header I have<br \/>\n<code>&lt;?php require(&#039;\/duck\/wordpress\/wp-blog-header.php&#039;); ?&gt;<\/code><\/p>\n<p>To get the post content I have<\/p>\n<pre><code>&lt;?php\n$posts = get_posts(&#039;numberposts=1&amp;offset=0&amp;category=4&#039;);\nforeach ($posts as $post) : setup_postdata( $post ); ?&gt;\n&lt;?php the_time(&#039;F j, Y&#039;); ?&gt; &lt;?php the_time(&#039;g:i a&#039;); ?&gt;\n&lt;?php the_content(); ?&gt;\n&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;#comments&quot;&gt;&lt;?php comments_number(&#039;No Comments&#039;, &#039;1 Comment&#039;, &#039;% Comments&#039;); ?&gt;&lt;\/a&gt;\n&lt;?php\nendforeach;\n?&gt;<\/code><\/pre>\n<p>As I said, this was working before but I&#8217;m not counting out that perhaps I messed something up the last time I worked on it. However, I&#8217;ve looked at other examples of similar code and this seems correct. Additionally, I&#8217;m not receiving any console errors and php validators say that syntax is alright. <\/p>\n<p>I&#8217;m admittedly not great with PHP, so I&#8217;m not sure what could be wrong. I am getting one weird error in the console timeline:<\/p>\n<blockquote>\n<p>Failed to clear temp storage: It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources. SecurityError<\/p>\n<\/blockquote>\n<p>I&#8217;m not sure if that could be related or not. <\/p>\n<p>I appreciate any advice that&#8217;ll help me troubleshoot this.<\/p>\n","protected":false},"template":"","class_list":["post-7331151","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7331151","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":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7331151\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7331151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}