In Advanced Custom Fields plugin, is it possible to display a WYSIWYG editor field in which p
tags are omitted?
2 Answers
strip_tags()
is not bad, but there may be a lot of tags you'll have to allow. So maybe you can use str_replace()
to only get rid of the <p>
-tag:
<?php
$field = get_field('wysiwyg'); // your wysiwyg field data
$strip = array('<p>','</p>'); // search for <p>
echo str_replace($strip,'',$field);
?>
Natively, I don't believe there is a way to do that. Are you looking to remove just P tags, or all html tags? In your template, you could use:
strip_tags($text,'<a><img><strong><b><em><i>')