Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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:

<?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.

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
add comment

Your Answer

 
discard

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.