woocommerce_disable_admin_bar filter-hookWC 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.

Usage

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.

Where the hook is called

wc_disable_admin_bar()
woocommerce_disable_admin_bar
WC_Admin::prevent_admin_access()
woocommerce_disable_admin_bar
woocommerce/includes/wc-user-functions.php 25
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' ) {

Where the hook is used in WooCommerce

Usage not found.