From time to time, I find WordPress’ built-in WYSIWYG editor annoying. If you’ve dealt with it much, you know it adds formatting tags around every new line of text. Usually these don’t bother me, as I want my text to be wrapped in paragraph tags or similar. However, for the times I want to extract ONLY the content and not the tags, here’s an easy way to strip all tags from WordPress. Just a word of caution though, these will strip the tags from ALL of your templates.
Add any of these lines to your functions.php file.
remove_filter (‘the_exceprt’, ‘wpautop’);
remove_filter (‘the_content’, ‘wpautop’);
All Paragraph tags:
Or, my personal favorite, use functions native to WordPress anywhere in your templates:
<?php echo get_the_excerpt(); ?>
<?php echo get_the_content(); ?>