# Hide categories only for a specific plan

**URL:** <https://community.hivepress.io/t/hide-categories-only-for-a-specific-plan/2330>\
**Category:** Memberships\
**Tags:** memberships\
**Created:** [October 13, 2022, 9:30pm UTC](https://community.hivepress.io/t/hide-categories-only-for-a-specific-plan/2330 "2022-10-13T21:30:50Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![yevhen](https://community.hivepress.io/user_avatar/community.hivepress.io/yevhen/32/23_2.png) [@yevhen](https://community.hivepress.io/u/yevhen)\
**Post date:** [October 16, 2022, 5:32pm UTC](https://community.hivepress.io/t/hide-categories-only-for-a-specific-plan/2330/10 "2022-10-16T17:32:22Z")

</div>

Please try this PHP snippet. Please change `1,2,3` on the categories id that you want to remove from the selection and please change your\_membership\_plan\_id on the membership plan id which hides these categories. Also please note that it can require further customization. If you are not familiar with code customization then please consider hiring someone for custom work [https://fvrr.co/32e7LvY](https://fvrr.co/32e7LvY)

```auto

add_filter(
	'hivepress/v1/models/listing/fields',
	function($fields){
		if(!is_user_logged_in() || !hivepress()->get_version('memberships')){
			return $fields;
		}
		
		$membership = \HivePress\Models\Membership::query()->filter(['user' => get_current_user_id()])->get_first();

        if(!$membership || your_membership_plan_id === $membership->get_plan__id()){
            $disabled_categories_ids = [1,2,3];
		
			if(isset($fields['categories']['options'])){
				foreach($disabled_categories_ids as $category_id){
					unset($fields['categories']['options'][$category_id]);
				}	
			}
        }
		
		return $fields;
	},
	10000
);

```

---

_[View the full topic](https://community.hivepress.io/t/hide-categories-only-for-a-specific-plan/2330)._
