WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to come up with a solution that would allow me to remove the default post types (pages, posts, comments, links, etc) from all the multi-site blogs EXECEPT the primary blog. It will remain fully functional. My purpose is to apply a custom post type to all the multi-site blogs to replace the defaults.

Any help in the right direction would be much appreciated.


share|improve this question
up vote 0 down vote accepted

I don't use Multisite much, but I believe something like this might work:

If I'm not mistaken, global $blog_id; lets you access the various "Blogs" ids. Then, the "Main Blog" should have an ID of 1.

So, removing the post type menus from all blogs that DO NOT have the id of 1 would go something like this:


function remove_menus() {    

    global $blog_id, $menu;

    if( $blog_id != '1' ) {

        $restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));

        end ($menu);    

        while (prev($menu)){
    $value = explode(' ',$menu[key($menu)][0]);
    if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}


add_action('admin_menu', 'remove_menus');

This is where I got the Remove Menus function:


Note: This hasn't been tested. Just a theory. . .I don't use multisite often and don't have one set up to try this on at the moment.

share|improve this answer
I ran accross the same post after I posted this and I was able to remove the menus which removes the post types as well. Thanks! – krazymatty Jan 27 '12 at 16:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.