Skip to content

Instantly share code, notes, and snippets.

@brianpurkiss
Created May 15, 2019 16:26
Show Gist options
  • Save brianpurkiss/2c7953c6ada84c779e23a087843c5835 to your computer and use it in GitHub Desktop.
Save brianpurkiss/2c7953c6ada84c779e23a087843c5835 to your computer and use it in GitHub Desktop.
Removing the <p> from ACF's WYSIWYG Field
<?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