wc_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.

Хуки из функции

Возвращает

true|false.

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

wc_disable_admin_bar( $show_admin_bar );
$show_admin_bar(true|false) (обязательный)
If should display admin bar.

Код wc_disable_admin_bar() WC 8.7.0

function wc_disable_admin_bar( $show_admin_bar ) {
	/**
	 * Controls whether the WooCommerce admin bar should be disabled.
	 *
	 * @since 3.0.0
	 *
	 * @param bool $enabled
	 */
	if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! ( current_user_can( 'edit_posts' ) || current_user_can( 'manage_woocommerce' ) ) ) {
		$show_admin_bar = false;
	}

	return $show_admin_bar;
}