PHP Issue – get_post no longer working
-
I’m having a strange issue. I have a test static web page that I’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.
In the header I have
<?php require('/duck/wordpress/wp-blog-header.php'); ?>
To get the post content I have
<?php $posts = get_posts('numberposts=1&offset=0&category=4'); foreach ($posts as $post) : setup_postdata( $post ); ?> <?php the_time('F j, Y'); ?> <?php the_time('g:i a'); ?> <?php the_content(); ?> <a href="<?php the_permalink(); ?>#comments"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></a> <?php endforeach; ?>
As I said, this was working before but I’m not counting out that perhaps I messed something up the last time I worked on it. However, I’ve looked at other examples of similar code and this seems correct. Additionally, I’m not receiving any console errors and php validators say that syntax is alright.
I’m admittedly not great with PHP, so I’m not sure what could be wrong. I am getting one weird error in the console timeline:
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
I’m not sure if that could be related or not.
I appreciate any advice that’ll help me troubleshoot this.
- The topic ‘PHP Issue – get_post no longer working’ is closed to new replies.