Check if Post Content is Empty

Handy trick I use to show / hide a content area in a custom layout if there is no content.

if( '' !== get_post()->post_content ) {
// do something
}

Further notes:

If the above fails to work, particularly within the loop, replace get_post with $post.

Source.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.