admin管理员组

文章数量:1325108

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');

Similarly trying to pull the body with

$post_content = get_the_content("", false, $post->ID);

Got me nothing.

I did also try

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

Which got me back an empty span;

<span class="cp-load-after-post"></span>

This being my first WP project, I'm hoping I missed something simple...

Update: I do see the expected text in the post_content field in the zl_posts table.

本文标签: functionspostgtpostcontent empty while all other properties are correct