Skip to:
Content
Pages
Categories
Search
Top
Bottom

Clean out HTML from copying, but allow bold

  • @rinh

    Participant

    Hi!
    When our users copy emails into the forum all the HTML table code shows up in the published post (it’s fine in the editor itself though). I found this filter which I suppose cleans out all HTML when copying

    //clean html when copy and paste into forum
    function bbp_tinymce_paste_plain_text( $plugins = array() ) {
        $plugins[] = 'paste';
        return $plugins;
    
    }
    add_filter( ‘bbp_get_tiny_mce_plugins’, ‘bbp_tinymce_paste_plain_text’ );

    I’m wondering if there’s a filter that would still allow bold to remain, but remove everything else?
    Thank you in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • @robin-w

    Moderator

    from this article

    https://www.tiny.cloud/docs/plugins/opensource/paste/

    try this, otherwise I don’t have a further solution

    //clean html when copy and paste into forum
    function bbp_tinymce_paste_plain_text( $plugins = array() ) {
        $plugins[] = 'paste';
    $paste_word_valid_elements[] = 'b,strong';
        return $plugins;
    
    }
    add_filter( ‘bbp_get_tiny_mce_plugins’, ‘bbp_tinymce_paste_plain_text’ );

    @robin-w

    Moderator

    do let us know if that works

    @rinh

    Participant

    Thank you Robin. I appreciate it. Unfortunately it did not work. I can’t get the snippet I posted to work either in fact, all HTML is still there.

    @rinh

    Participant

    This a little funny, but a solution I had never noticed before is that if I right click in the editor or do ctrl + shift + V there’s an option to paste as plain text. It doesn’t make bold etc carry over, but at least there’s no need to paste into a text editor first.

    @robin-w

    Moderator

    🙂

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