Wordpress - Get the content of a specific page (by ID)

<?php

// would echo post 7's content up until the <!--more--> tag
$post_7 = get_post(7); 
$excerpt = $post_7->post_excerpt;
echo $excerpt;

// would get post 12's entire content after which you
// can manipulate it with your own trimming preferences
$post_12 = get_post(12); 
$trim_me = $post_12->post_content;
my_trim_function( $trim_me );

?>

Here you go !

<?php
$my_id = 5369;
$post_id_5369 = get_post($my_id);
$content = $post_id_5369->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
?>

$post   = get_post( 42 );

$output =  apply_filters( 'the_content', $post->post_content );

echo $output;

from https://developer.wordpress.org/reference/functions/get_post/

Tags:

Pages

Content