Skip to main content

display_mode_in

Filter Free Since v1.0.0

Filters the allowed display-mode values accepted by NoticeManager::get_active() when building the GET /benecaster/v1/notices response. Default: ['bell', 'bar', 'both']. Removing a mode prevents notices targeted to that mode from appearing.

Parameters

Name Type Default Description
$allowed_modes array Array of allowed display mode strings; default ['bell', 'bar', 'both']

Returns: array

Example

add_filter( 'display_mode_in', function( $allowed_modes ) {
    // Prevent notices from appearing in the admin bar globally.
    return array_values( array_diff( $allowed_modes, [ 'bar', 'both' ] ) );
} );

Affects

  • NoticeManager::get_active() display-mode resolution