Skip to:
Content
Pages
Categories
Search
Top
Bottom

Formatted text


  • tinnakvist
    Participant

    @tinnakvist

    Hi, I’m a webmaster at a website that has bbPress.
    And they often paste text in from another website that results in leaving a lot of formatted text. Is there a way to prevent that? It would be nice with a feature that could remove the formatted text.

    Best regards,
    Tinna

Viewing 4 replies - 1 through 4 (of 4 total)

  • wpturk
    Participant

    @wpturk

    Hi, mostly formatting comes with copy-paste of html text. If you want to strip html from the text you can make use of some WordPress functions: wp_strip_all_tags(), convert_chars() etc …

    ex:

    function aa_stripped_content($content) {
        
        $content = wp_strip_all_tags($content);
        return $content;
    }
    add_filter ('bbp_get_topic_content', 'aa_stripped_content'); 

    tinnakvist
    Participant

    @tinnakvist

    Perfect! Than you!


    wpturk
    Participant

    @wpturk

    you are welcome!


    wpturk
    Participant

    @wpturk

    you need this additional line if you want to strip replies too:

    add_filter ('bbp_get_reply_content', 'aa_stripped_content');

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar