Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding extra html to activity updates is being filtered


  • Fred
    Participant

    @castihell

    Hi there, I’ve been creating a plugin which optionally can have its own status updates added to Buddypress activity updates by using the function bp_activity_add.

    The problem is that when specifiying the ‘content’ for the activity to add, it goes through the apply_filters function which will strip everything except spans, imgs and p tags.

    Is there any way (without hacking the bp code) to make sure it does not get so heavily filtered? I would like to add some divs and some other html tags to an activity update so that my activity update gets correctly formatted.

    Thanks!

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

  • shanebp
    Moderator

    @shanebp

    You should be able to add to the allowed tags array like so:

    function fred_whitelist_tags_in_activity( $allowedtags ) {
        $allowedtags['a']['target'] = array();
        return $allowedtags;
    }
    add_filter( 'bp_activity_allowed_tags', 'fred_whitelist_tags_in_activity' );

    You may want to do an add_filter / remove_filter in your plugin so that you don’t open up the allowed tags for other activity items.


    Fred
    Participant

    @castihell

    Thanks shanebp, appreciate it a lot. Will do 🙂 .

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding extra html to activity updates is being filtered’ is closed to new replies.
Skip to toolbar