woocommerce_disable_admin_bar

woocommerce_disable_admin_bar

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_disable_admin_bar') is found 2 times:

  • /includes/admin/class-wc-admin.php line 164
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
         * This filter is documented in ../wc-user-functions.php
         *
         * @since 3.6.0
         */
        apply_filters( 'woocommerce_disable_admin_bar', true )
        && isset( $_SERVER['SCRIPT_FILENAME'] )
        && ! in_array( basename( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_FILENAME'] ) ) ), $exempted_paths, true )
    ) {
        $has_cap     = false;
        $access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
  • /includes/wc-user-functions.php line 34
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
         * @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;
    }
    add_filter( 'show_admin_bar', 'wc_disable_admin_bar', 10, 1 ); // phpcs:ignore WordPress.VIP.AdminBarRemoval.RemovalDetected