How can i prevent users from deleting their blog?

How can i prevent users from deleting their blog on the network? in their dashboard there is a tools button if i open that i see an option delete site. Can you tell me how to remove that?

Best regards,
Kevin.

  • kevin
    • WP Core Meltdown

    i think you misunderstood my question i am not searching for a plugin that enables the users to delete their site in their dashboard i am searching for a solution to get rid of the delete site option in the users admin without have to access their admin or is that possible with this plugin? so yes how? also if possible i don't want to overload my sites with to much plugins so if possible i would like to have the most light solution.

    Please advice,
    Kevin.

  • Ash
    • WordPress Hacker

    Hello @kevin

    Please try the following code:

    add_action( 'admin_menu', 'remove_menus' );
    function remove_menus() {
      if( ! is_super_admin() ){
        remove_menu_page( 'ms-delete-site.php' );
      }
    }

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • kevin
    • WP Core Meltdown

    I prefer to use mu-plugin like you say so I don't have to worry when updates occur but its not working. i am logged in as super admin but do not know if this is relevant for the subsite owner what i want is simple that the subsite owner is not able to delete his or her blog for now he can delete it using the option i mentioned earlier.

    Best regards
    Kevin

  • Ash
    • WordPress Hacker

    Please try the following code:

    add_action( 'admin_menu', 'remove_menus' );
    function remove_menus() {
      if( ! is_super_admin() ){
        remove_submenu_page( 'tools.php', 'ms-delete-site.php' );
      }
    }

    Note that, this code will remove the Delete this site menu from tools menu. And you need to login using a subsite admin, not super admin. Super admin will always see the delete site option.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.