Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Removes the "tickets" category from the WooCommerce product categories widget.
- *
- * You can drop this into your theme's functions.php file. You *must* change the
- * value of $exclude_id in this function or it is highly unlikely that it will
- * work on your installation.
- *
- * You can find the "tickets" ID by going to Products > Categories and clicking the
- * "Tickets" category. The URL will look like:
- *
- * wp-admin/edit-tags.php?action=edit&taxonomy=product_cat&tag_ID=13&post_type=product
- * ^^^^^^^^^
- *
- * What we are interested in is what immediately follows tag_ID, in this case 13.
- */
- function exclude_wootickets_category($args) {
- // You need to change the value of $exclude_id
- // to the ticket category ID on your installation!
- $exclude_id = 13;
- if (!isset($args['exclude'])) $args['exclude'] = $exclude_id;
- else $args['exclude'] .= ",$exclude_id";
- return $args;
- }
- add_filter('woocommerce_product_categories_widget_args', 'exclude_wootickets_category');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement