0

In Advanced Custom Fields plugin, is it possible to display a WYSIWYG editor field in which p tags are omitted?

2 Answers 2

0

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);
?>
1

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>') 

http://php.net/manual/en/function.strip-tags.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.