WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to Strip_Tags The_Content (4 posts)

  1. ewwink
    Member
    Posted 3 years ago #

    Hello all,

    I want to filter the_content to allow like <p> tags only but with code below

    add_filter('the_content','strip_tags');

    it strip all tags so how to allow <p>?

    thanks

  2. stvwlf
    Member
    Posted 3 years ago #

    Something like this

    function my_strip_tags($content='') {
       return strip_tags($content, '<p>');
    }
    add_filter('the_content','my_strip_tags');

    I didn't test the code - its to demonstrate the principle. That will leave P tags in place and strip all others.

  3. ewwink
    Member
    Posted 3 years ago #

    thanks stvwlf its work

  4. DoZ
    Member
    Posted 3 years ago #

    SUPER TRICK!
    Does anybody know how to force to paste as plain text?
    I know there's the 'T' button, but since some client doesn't want to learn how to... I need to force him!

Topic Closed

This topic has been closed to new replies.

About this Topic