Support » Themes and Templates » Strip tags but allow some

  • Resolved Indent


    How do I remove all tags but allow some?
    I want to remove all tags from the_content but allow the p and a tag. I have tried this inside a div;

    <?php echo strip_tags(get_the_content()),'<p><a>';?>
    That strips every tag. What is wrong?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorry, the code is wrong. Once again:

    <?php echo strip_tags(get_the_content(),'<p><a>');?>

    Abit of a late reply, but you haven’t separated the tags with a comma.

    strip_tags(get_the_content(), '<p>, <ul>, <li>, <a>')

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Strip tags but allow some’ is closed to new replies.