When i need to get content of a post with ID, I'm always using this function :

function getContentByID($id)
$content_post = get_post($id);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;

Can you tell me, why there isn't any core function for this ? There are functions like get_the_title($id), get_the_category($id) ...


There is get_post_field(), which is very, very close to your proposed solution.

$content = get_post_field('post_content',$your_post_id);

Frankly, I think WordPress already suffers from helper function overload, but there you go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.