Or even simpler:
echo wp_strip_all_tags( get_the_content() );
By using:
get_the_content()
Retrieve the post content. (Must be used in a Loop)
An important difference from
the_content()
is thatget_the_content()
does not pass the content through the ‘the_content
‘. This means thatget_the_content()
will not auto-embed videos or expand shortcodes, among other things.wp_strip_all_tags()
Properly strip all HTML tags including script and style.