Skip to content

Instantly share code, notes, and snippets.

@metinsaylan
Created December 21, 2023 22:35
Show Gist options
  • Save metinsaylan/6414d5d58800902a3d9043652fd467e9 to your computer and use it in GitHub Desktop.
Save metinsaylan/6414d5d58800902a3d9043652fd467e9 to your computer and use it in GitHub Desktop.
Get WordPress Post Content by Post ID
<?php
$post_id = 123; // Replace with the actual Post ID
$post = get_post( $post_id );
if ( $post ) {
$post_content = apply_filters( 'the_content', $post->post_content );
echo $post_content;
} else {
echo 'Post not found';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment