admin管理员组文章数量:1324876
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
版权声明:本文标题:functions - $post->post_content empty while all other properties are correct 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742141943a2422617.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论