woocommerce_dismiss_admin_notice_capability filter-hookWC 6.7.0

Filter the capability required to dismiss a given notice.

Usage

add_filter( 'woocommerce_dismiss_admin_notice_capability', 'wp_kama_woocommerce_dismiss_admin_notice_capability_filter', 10, 2 );

/**
 * Function for `woocommerce_dismiss_admin_notice_capability` filter-hook.
 * 
 * @param string $default_capability The default required capability.
 * @param string $notice_name        The notice name.
 *
 * @return string
 */
function wp_kama_woocommerce_dismiss_admin_notice_capability_filter( $default_capability, $notice_name ){

	// filter...
	return $default_capability;
}
$default_capability(string)
The default required capability.
$notice_name(string)
The notice name.

Changelog

Since 6.7.0 Introduced.

Where the hook is called

WC_Admin_Notices::hide_notices()
woocommerce_dismiss_admin_notice_capability
woocommerce/includes/admin/class-wc-admin-notices.php 280
$required_capability = apply_filters( 'woocommerce_dismiss_admin_notice_capability', 'manage_woocommerce', $notice_name );

Where the hook is used in WooCommerce

woocommerce/src/Internal/Admin/ProductReviews/ReviewsCommentsOverrides.php 23
self::add_filter( 'woocommerce_dismiss_admin_notice_capability', array( $this, 'get_dismiss_capability' ), 10, 2 );