woocommerce_disable_admin_bar хук-фильтрWC 1.0

Prevent any user who cannot 'edit_posts' (subscribers, customers etc) from seeing the admin bar.

Note: get_option( 'woocommerce_lock_down_admin', true ) is a deprecated option here for backwards compatibility. Defaults to true.

Использование

add_filter( 'woocommerce_disable_admin_bar', 'wp_kama_woocommerce_disable_admin_bar_filter' );

/**
 * Function for `woocommerce_disable_admin_bar` filter-hook.
 * 
 * @param bool $show_admin_bar If should display admin bar.
 *
 * @return bool
 */
function wp_kama_woocommerce_disable_admin_bar_filter( $show_admin_bar ){

	// filter...
	return $show_admin_bar;
}
$show_admin_bar(true|false)
If should display admin bar.

Где вызывается хук

wc_disable_admin_bar()
woocommerce_disable_admin_bar
WC_Admin::prevent_admin_access()
woocommerce_disable_admin_bar
woocommerce/includes/wc-user-functions.php 22
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! ( current_user_can( 'edit_posts' ) || current_user_can( 'manage_woocommerce' ) ) ) {
woocommerce/includes/admin/class-wc-admin.php 160
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! wp_doing_ajax() && isset( $_SERVER['SCRIPT_FILENAME'] ) && basename( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_FILENAME'] ) ) ) !== 'admin-post.php' ) {

Где используется хук в WooCommerce

Использование не найдено.