daily pastebin goal

WooCommerce - Restore admin category dropdown

lorro Oct 27th, 2017 481 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // restore old dropdown category filter on admin products page
  3. // snippet goes in functions.php for your child theme if you have one, or you can use the "My Custom Functions" plugin
  4. add_action( 'restrict_manage_posts', 'wcacd_category_dropdown', 15 );
  5. function wcacd_category_dropdown() {
  6.   // show the old dropdown category filter from WC 3.1.2
  7.   wc_product_dropdown_categories( array( 'option_select_text' => __( 'Filter by category', 'woocommerce' ) ) );
  8.   // hide the WC 3.2+ ajax category filter
  9.   print '<style>.post-type-product .tablenav div .select2 {display:none;}</style>';
  10. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand