Created
May 15, 2019 16:26
-
-
Save brianpurkiss/2c7953c6ada84c779e23a087843c5835 to your computer and use it in GitHub Desktop.
Removing the <p> from ACF's WYSIWYG Field
This file contains 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 | |
// Uses a str_replace to get rid of the p tags for a ACF WYSIWYG field. | |
// This preserves other styling in the WYSIWYG field compared to other methods. | |
$text = get_field('the_field'); | |
$stripped_text = str_replace(array('<p>','</p>'),'',$text); | |
echo $stripped_text; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment