How to get the post content after WordPress post processing?

I have a plugin that will send tutorial emails to our users. These tutorials are created in wordpress and stored in wp_posts table in the database.

Of course I could simply run a query to get the post and that’s it. But is there a special built-in function that I can use to get the post content after WordPress post processing?

Read More

I am thing of using get_post but I’m not sure if this is the best thing to do:

<?php
$my_id = 7;
$post_id_7 = get_post($my_id); 
$post_content = $post_id_7->post_content;
?> 

Thanks for any tips.

Related posts

Leave a Reply

1 comment

  1. If by “post processing” you mean the autoformatting, the shortcode processing, that sort of thing, then you want to pass the content through the the_content filters.

    $my_id = 7;
    $post_id_7 = get_post($my_id); 
    $post_content = $post_id_7->post_content;
    $post_content = apply_filters('the_content',$post_content);
    

    http://codex.wordpress.org/Function_Reference/apply_filters

    You can see much of what will be applied by default by looking at the source of wp-includes/default-filters.php. However, plugins and themes can add filters so you may find that you want to pick and choose what gets applieds.