# How do I hide Pages & Posts sections in MainWP?

**URL:** <https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949>\
**Category:** How do I\
**Created:** [November 17, 2022, 3:07pm UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949 "2022-11-17T15:07:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![d19dotca](https://community.mainwp.com/user_avatar/community.mainwp.com/d19dotca/32/6269_2.png) [@d19dotca](https://community.mainwp.com/u/d19dotca)\
**Post date:** [November 17, 2022, 3:07pm UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/1 "2022-11-17T15:07:23Z")

</div>

Hello, I mostly strictly use MainWP for managing updates and for code snippets that I want deployed across all my client sites. As a result I never use the built-in Pages and Posts functionality but it’s always consuming space in the left-hand menu bar in MainWP. Is there a way to disable this at all so it’s hidden for the features I never use nor ever really intend to use?

---

<div class="post-metadata">

**Author:** ![kwcjr](https://community.mainwp.com/user_avatar/community.mainwp.com/kwcjr/32/2244_2.png) [@kwcjr](https://community.mainwp.com/u/kwcjr)\
**Post date:** [November 17, 2022, 9:21pm UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/2 "2022-11-17T21:21:39Z")

</div>

Please reference this thread here: [https://newcom.mainwp.com/t/remove-multiple-options-for-one-user-role-only/2774](https://newcom.mainwp.com/t/remove-multiple-options-for-one-user-role-only/2774)

---

<div class="post-metadata">

**Author:** ![d19dotca](https://community.mainwp.com/user_avatar/community.mainwp.com/d19dotca/32/6269_2.png) [@d19dotca](https://community.mainwp.com/u/d19dotca)\
**Post date:** [November 25, 2022, 5:54am UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/3 "2022-11-25T05:54:23Z")

</div>

It isn’t working for me, but maybe I’m mis-using it? I obviously made a few small changes (i.e. the role used, etc) but am only ever seeing “Sites” in the menu bar and nothing else when it’s enabled.

Ultimately I only want to remove Pages and Posts and keep the rest, is there a different way to achieve this or a different coding change needed to the snippet?

Here’s my current snippet:

```auto
add_filter( 'mainwp_main_menu', 'd19_mainwp_main_menu', 10, 1 );
function d19_mainwp_main_menu( $left_menus ) {
	if ( current_user_can( 'administrator' ) ) {
		$left_menus = array();
		$left_menus['mainwp_tab'] = array( 
			array(
				'Sites',
				'Updates',
				'Plugins',
				'Themes',
				'Users',
				'Extensions',
				'Settings',
				'Info'
			)
		);
	}	
	return $left_menus;
}

```

---

<div class="post-metadata">

**Author:** ![d19dotca](https://community.mainwp.com/user_avatar/community.mainwp.com/d19dotca/32/6269_2.png) [@d19dotca](https://community.mainwp.com/u/d19dotca)\
**Post date:** [November 25, 2022, 7:27am UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/4 "2022-11-25T07:27:36Z")

</div>

I was able to make this work after finding different examples, but this seems like an inefficient method, is there perhaps a better way to clean up this snippet?

```auto
add_filter(
    "mainwp_main_menu_disable_menu_items",
    "d19_mainwp_main_menu_disable_menu_items"
);
if (!function_exists("d19_mainwp_main_menu_disable_menu_items")) {
    function d19_mainwp_main_menu_disable_menu_items($disable_menus)
    {
        if (isset($disable_menus["level_2"]["PageBulkManage"])) {
            $disable_menus["level_2"]["PageBulkManage"] = true;
        }
        if (isset($disable_menus["level_2"]["PostBulkManage"])) {
            $disable_menus["level_2"]["PostBulkManage"] = true;
        }
        if (isset($disable_menus["level_2"]["UserBulkManage"])) {
            $disable_menus["level_2"]["UserBulkManage"] = true;
        }
        return $disable_menus;
    }
}

```

---

<div class="post-metadata">

**Author:** ![kwcjr](https://community.mainwp.com/user_avatar/community.mainwp.com/kwcjr/32/2244_2.png) [@kwcjr](https://community.mainwp.com/u/kwcjr)\
**Post date:** [November 25, 2022, 3:46pm UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/5 "2022-11-25T15:46:30Z")

</div>

What’s “inefficient” about this? Looks fine to me…

---

<div class="post-metadata">

**Author:** ![d19dotca](https://community.mainwp.com/user_avatar/community.mainwp.com/d19dotca/32/6269_2.png) [@d19dotca](https://community.mainwp.com/u/d19dotca)\
**Post date:** [November 25, 2022, 4:08pm UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/6 "2022-11-25T16:08:37Z")

</div>

Well for one it isn’t anything close to what you originally suggested so I feel like I’m doing something wrong, haha. But also it’d be nice if it was somehow an array where I didn’t need to duplicate the names of tabs each time. So was assuming there’s a better way, a more efficient way. It’d be nice if there was formal documentation from MainWP on how to hide menu items.

---

<div class="post-metadata">

**Author:** ![kwcjr](https://community.mainwp.com/user_avatar/community.mainwp.com/kwcjr/32/2244_2.png) [@kwcjr](https://community.mainwp.com/u/kwcjr)\
**Post date:** [November 25, 2022, 4:13pm UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/7 "2022-11-25T16:13:11Z")

</div>

@d19dotca Yeah if it works it works, you are the only one that will see the code ;o) I know not the answer you were wanting lol

This was a quick addition a few years ago because somebody was asking about it on this Forum. Other than the How To’s on here, there was never a need for the documentation. You are like literally the 5th person that has asked about this.

I’m sure we could have @bogdan write up a short KB Article when there is some spare time to do so, but I can not give a ETA as to when this will be done at this time.

---

<div class="post-metadata">

**Author:** ![d19dotca](https://community.mainwp.com/user_avatar/community.mainwp.com/d19dotca/32/6269_2.png) [@d19dotca](https://community.mainwp.com/u/d19dotca)\
**Post date:** [December 1, 2022, 7:11am UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/8 "2022-12-01T07:11:15Z")

</div>

Understandable it’s a low priority but it’s definitely not a one-off if there’s been more than 3 or 4 people asking for it. 😉 Hoping this can be improved in the future.

I’m trying to expand it to hide the new Clients page too but it’s not working. Here’s what I’m adding in currently, is the ManageClients supposed to be something different perhaps?

```auto
add_filter(
    "mainwp_main_menu_disable_menu_items",
    "d19_mainwp_main_menu_disable_menu_items"
);
if (!function_exists("d19_mainwp_main_menu_disable_menu_items")) {
    function d19_mainwp_main_menu_disable_menu_items($disable_menus)
    {
        if (isset($disable_menus["level_2"]["PageBulkManage"])) {
            $disable_menus["level_2"]["PageBulkManage"] = true;
        }
        if (isset($disable_menus["level_2"]["PostBulkManage"])) {
            $disable_menus["level_2"]["PostBulkManage"] = true;
        }
        if (isset($disable_menus["level_2"]["UserBulkManage"])) {
            $disable_menus["level_2"]["UserBulkManage"] = true;
        }
        if (isset($disable_menus["level_2"]["ManageClients"])) {
            $disable_menus["level_2"]["ManageClients"] = true;
        }
        return $disable_menus;
    }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://community.mainwp.com/uploads/default/original/2X/4/4cfc87ac67e4ebdbfa0bbf0b19c8657f35a29a5b.png) [@system](https://community.mainwp.com/u/system)\
**Post date:** [December 31, 2022, 7:12am UTC](https://community.mainwp.com/t/how-do-i-hide-pages-posts-sections-in-mainwp/5949/9 "2022-12-31T07:12:06Z")

</div>

Closed on December 31, 2022, 7:12am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
