Created
June 9, 2015 18:37
-
-
Save data-enhanced/1a3b5dfc0ec750a066ee to your computer and use it in GitHub Desktop.
WP excerpt remove p tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $myExcerpt = get_the_excerpt(); | |
| $tags = array("<p>", "</p>"); | |
| $myExcerpt = str_replace($tags, "", $myExcerpt); | |
| echo $myExcerpt; | |
| ?> | |
| <!-- https://wordpress.org/support/topic/remove-ltpgt-tag-from-excerpt --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The better way is
wp_strip_all_tags(get_the_excerpt())