Remove default post types on all sites except primary blog. WPMU

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.

-Phil

2 Answers
2

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:

<?php 

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:

http://www.wprecipes.com/how-to-remove-menus-in-wordpress-dashboard

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.

Leave a Comment