WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I am wanting to achieve is to remove an action called inside of another action.

The action is calling a style, and although I have tried to deregister, and dequeue the style, it is still displaying on the admin pages.

Here is the code snippet (inside of WooCommerce):

function woocommerce_admin_menu() {
    global $menu, $woocommerce;...

    $print_css_on = apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'woocommerce_page_woocommerce_status', 'product_page_woocommerce_attributes', 'edit-tags.php', 'edit.php', 'index.php', 'post-new.php', 'post.php' ) );

    foreach ( $print_css_on as $page )
        add_action( 'admin_print_styles-'. $page, 'woocommerce_admin_css' );
add_action('admin_menu', 'woocommerce_admin_menu', 9);

What I've tried to do:

add_action('init', 'remove_action_123', 999);
function remove_action_123() {
        $print_css_on = apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'woocommerce_page_woocommerce_status', 'product_page_woocommerce_attributes', 'edit-tags.php', 'edit.php', 'index.php', 'post-new.php', 'post.php' ) );add_action('init', 'remove_action', 999);

        // Remove 'woocommerce_admin_menu'
    foreach ( $print_css_on as $page )
    remove_action( 'admin_print_styles-'. $page, 'woocommerce_admin_css' );

This is how it's being enqueued:

function woocommerce_admin_css() {
    global $woocommerce, $typenow, $post, $wp_scripts;...

    if ( $typenow == '' || $typenow == "product" || $typenow == "shop_order" || $typenow == "shop_coupon" ) {
        wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css' );


So I also tried:

wp_dequeue_style( 'woocommerce_admin_styles' )

But it is still not working.

Any ideas on how to successfully remove this css?

Thanks! Roc.

share|improve this question
up vote 3 down vote accepted

To clean up a complete array use the helper function __return_empty_array() as callback:

add_filter( 'woocommerce_screen_ids', '__return_empty_array', );

Similar helpers for further usage are:

  • __return_true()
  • __return_false()
  • __return_zero()
  • __return_null()
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.