When I’m trying to utilise the post functions of WordPress on another page, something odd happens.
I’m attempting to grab a specific post using the predefined ID of the WordPress post and the title, content and date within it using the code as follows:
$post = get_post( $_GET['p'] );
echo "<hr><h1>" . $post->post_title . "<br /></h1>";
echo apply_filters( 'the_content', $post->post-content ) . "<br /><br />";
echo "Published on: " . $post->post_date;
However this produces the following output:
When the 0 should be replaced by a lot of lopus ipsum text.
I’ve had a look around the WordPress support sites and Google to no avail, any ideas on how to fix this would be much appreciated.
It’s
post_content
notpost-content
🙂