Skip to:
Content
Pages
Categories
Search
Top
Bottom

Strip embeds like youtube and image tags


  • sonalsinha21
    Participant

    @sonalsinha21

    I have asked clients to paste image links on my website using ibb or imgur but the sites remove the images after a while.

    Is there an option to strip the html and have plain text and no embeds.

    So basically if someone shares a youtube video i just need the URL and not the embedded video which goes to not found if in future they delete it. Or same applies for image no img tag only the plain text based URL (no a tags as well)

    Just plain text based message with no a tag and embed so that even if its deleted in future it just remains as a text in the forum response and not as a 404.

    Regards,

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

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Most embeds can be disabled via the “Auto-embed links” setting in:

    Admin > Settings > Forums

    You can also permanently unhook them:

    remove_action( 'bbp_init', 'bbp_reply_content_autoembed', 8 );
    remove_action( 'bbp_init', 'bbp_topic_content_autoembed', 8 );
    

    Images are a bit trickier, as you’ll need to remove img from the allowed-tags array:

    add_filter( 'bbp_kses_allowed_tags', function( $tags = array() ) {
        unset( $tags['img'] );
        return $tags;
    } );
    

    sonalsinha21
    Participant

    @sonalsinha21

    Thank you so much this resolved the problem.

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