$post->post_content empty while all other properties are correct


I’m trying to pull raw post content in order to identify if a particular shortcode is used, and if so, what its properties are. All of the properties of my $post object return what I expect except for post_content, which seems to give me an empty value. I’ve tried removing all markup from the body in order to avoid any potential pre-processing, but even then I get nothing. Here’s how I try for the content;

    $content_post = get_post($post->ID, OBJECT, 'edit');
    $content = $content_post->post_content;

I got the same result using

    $content_post = get_post($post->ID, OBJECT, 'raw');

This being my first WP project, I’m hoping I missed something simple…

, GoetzOnline 2 years 2020-09-02T11:10:26-05:00 0 Answers 56 views 0

Leave an answer