Advertisement
BakerMan

Exclude WooTickets Ticket Category

Apr 6th, 2013
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. /**
  2.  * Removes the "tickets" category from the WooCommerce product categories widget.
  3.  *
  4.  * You can drop this into your theme's functions.php file. You *must* change the
  5.  * value of $exclude_id in this function or it is highly unlikely that it will
  6.  * work on your installation.
  7.  *
  8.  * You can find the "tickets" ID by going to Products > Categories and clicking the
  9.  * "Tickets" category. The URL will look like:
  10.  *
  11.  * wp-admin/edit-tags.php?action=edit&taxonomy=product_cat&tag_ID=13&post_type=product
  12.  *                                                         ^^^^^^^^^
  13.  *
  14.  * What we are interested in is what immediately follows tag_ID, in this case 13.
  15.  */
  16. function exclude_wootickets_category($args) {
  17.     // You need to change the value of $exclude_id
  18.     // to the ticket category ID on your installation!
  19.     $exclude_id = 13;
  20.  
  21.     if (!isset($args['exclude'])) $args['exclude'] = $exclude_id;
  22.     else $args['exclude'] .= ",$exclude_id";
  23.  
  24.     return $args;
  25. }
  26.  
  27. add_filter('woocommerce_product_categories_widget_args', 'exclude_wootickets_category');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement