bp_groups_filter_kses( string $content = '' )
Filter output of Group Description through WordPress’s KSES API.
Description
Parameters
- $content
-
(Optional) Content to filter.
Default value: ''
Return
(string)
Source
File: bp-groups/bp-groups-filters.php
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | function bp_groups_filter_kses( $content = '' ) { /** * Note that we don't immediately bail if $content is empty. This is because * WordPress's KSES API calls several other filters that might be relevant * to someone's workflow (like `pre_kses`) */ // Get allowed tags using core WordPress API allowing third party plugins // to target the specific `buddypress-groups` context. $allowed_tags = wp_kses_allowed_html( 'buddypress-groups' ); // Add our own tags allowed in group descriptions. $allowed_tags [ 'a' ][ 'class' ] = array (); $allowed_tags [ 'img' ] = array (); $allowed_tags [ 'img' ][ 'src' ] = array (); $allowed_tags [ 'img' ][ 'alt' ] = array (); $allowed_tags [ 'img' ][ 'width' ] = array (); $allowed_tags [ 'img' ][ 'height' ] = array (); $allowed_tags [ 'img' ][ 'class' ] = array (); $allowed_tags [ 'img' ][ 'id' ] = array (); $allowed_tags [ 'code' ] = array (); /** * Filters the HTML elements allowed for a given context. * * @since BuddyPress 1.2.0 * * @param string $allowed_tags Allowed tags, attributes, and/or entities. */ $tags = apply_filters( 'bp_groups_filter_kses' , $allowed_tags ); // Return KSES'ed content, allowing the above tags. return wp_kses( $content , $tags ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.