Skip to content

Filter Hooks

BuddyPress Profanity exposes five filter hooks for customization. All hooks are in the buddypress-profanity text domain namespace.


File: includes/wbbprof-admin-public-functions.php:32

Purpose: Modify the list of content types available in the Filter Scope section of General Settings.

Use this to add custom content types that your own plugin or integration needs to expose as filterable options, or to remove content types that are not relevant to your site.

Signature:

apply_filters( 'wbbprof_content_to_filter_array', array $content_filter )

Parameter:

  • $content_filter (array) — Associative array of slug => label pairs. Default keys: status_updates, activity_comments, messages. When bbPress is active, bbpress_title and bbpress_content are added before this filter runs.

Return: Modified $content_filter array.

Example — adding a custom content type:

add_filter( 'wbbprof_content_to_filter_array', function( $content_filter ) {
$content_filter['my_custom_type'] = __( 'My Custom Content', 'my-plugin' );
return $content_filter;
} );

Known consumer: The bp-hashtags plugin uses this filter to register additional content types.


File: includes/wbbprof-admin-public-functions.php:50

Purpose: Modify the list of replacement character options shown in the Filter Character dropdown on General Settings.

Use this alongside wbbprof_custom_character to add a new symbol option that site owners can select in the admin.

Signature:

apply_filters( 'wbbprof_word_rendering_symbols', array $rendering_symbols )

Parameter:

  • $rendering_symbols (array) — Associative array of slug => label pairs. Default keys: asterisk, dollar, question, exclamation, hyphen, hash, tilde, blank.

Return: Modified $rendering_symbols array.

Example — adding a percent sign option:

add_filter( 'wbbprof_word_rendering_symbols', function( $symbols ) {
$symbols['percent'] = '[%] Percent';
return $symbols;
} );

When a site owner selects your new option and saves, the stored character value will be percent. The plugin’s built-in switch statement has no case for percent, so it will fall through to the default branch and call wbbprof_custom_character to get the actual character.


File: public/class-buddypress-profanity-public.php:154–155

Purpose: Supply the replacement character when the stored character value does not match any of the built-in slugs (asterisk, dollar, question, exclamation, hyphen, hash, tilde, blank).

This hook is the runtime counterpart to wbbprof_word_rendering_symbols. Register both filters together.

Signature:

apply_filters( 'wbbprof_custom_character', string $symbol )

Parameter:

  • $symbol (string) — Currently an empty string ('') when called. The default branch in load_settings falls through to * if no filter returns a truthy value.

Return: The character string to use for replacement, or an empty/falsy value to fall back to *.

Important — double call: The plugin currently calls apply_filters('wbbprof_custom_character', $symbol) twice in sequence on lines 154 and 155 — once to test truthiness, then again to read the value. Any consumer filter runs twice per load_settings() invocation. This is a known code quality issue; write your callback to be idempotent (pure function, no side effects).

Example — providing the percent character for a custom percent slug:

add_filter( 'wbbprof_custom_character', function( $symbol ) {
// Only override when the admin has selected our custom slug.
$settings = bp_get_option( 'wbbprof_settings' );
if ( isset( $settings['character'] ) && 'percent' === $settings['character'] ) {
return '%';
}
return $symbol;
} );

File: includes/admin/class-wbbprof-admin.php:72

Purpose: Modify the admin sidebar tab registry. Pro or companion plugins can add their own tabs to the BuddyPress Profanity settings page.

Signature:

apply_filters( 'wbbprof_admin_tabs', array $tabs )

Parameter:

  • $tabs (array) — Associative array keyed by tab slug. Each entry is an array with keys:
    • label (string) — Display label
    • icon (string) — Dashicons class (e.g. dashicons-admin-settings)
    • group (string) — Sidebar group: main, settings, or account

Default tabs: overview, general, import, faq, license.

Return: Modified $tabs array.

Example — adding a Pro tab:

add_filter( 'wbbprof_admin_tabs', function( $tabs ) {
$tabs['pro_settings'] = array(
'label' => __( 'Pro Settings', 'my-pro-plugin' ),
'icon' => 'dashicons-star-filled',
'group' => 'settings',
);
return $tabs;
} );

To render the tab’s content, your plugin needs to hook into the settings page render to detect $_GET['tab'] === 'pro_settings' and output the relevant HTML.


File: edd-license/edd-plugin-license.php:124

Purpose: Toggle SSL verification on the license activation and deactivation API requests. Intended for staging or local development environments where the server cannot verify the certificate chain.

Signature:

apply_filters( 'wbbprof_license_api_sslverify', bool $sslverify )

Parameter:

  • $sslverify (bool) — Default true.

Return: false to disable SSL verification, true to keep it enabled.

Example — disable on local/staging:

add_filter( 'wbbprof_license_api_sslverify', function( $verify ) {
if ( defined( 'WP_LOCAL_DEV' ) && WP_LOCAL_DEV ) {
return false;
}
return $verify;
} );

Do not set this to false on production sites.


The public display filtering (masking keywords, emails, phones) runs entirely inside the BuddyPress_Profanity_Public class and is not directly hookable beyond the five filters listed above. To suppress filtering for a specific piece of content, you would need to remove the relevant BuddyPress display filter added by the plugin — but those internal hook priorities may change between versions and are not considered a stable API.