Make theme visible only to specific blog

Hello,

I am starting a network, installed prosites, now the theme I am using for the network, I don't want it visible to anyone else. How do i do that?

Thanks,
Srikanth

  • Sajid
    • DEV MAN’s Sidekick

    Hi @srikanth

    Hope you are doing good today and welcome to WPMUDEV community :slight_smile:

    You can protect a theme from your network by enabling Premium Themes module from Network > Pro Sites > Modules.

    Now you will see another menu under Pro Sites > Premium Themes. Click here and from there select none for the theme that you don't want to be used for any other blog on your network (see screenshots). You can also chose members having specific or minimum level who can use this theme.

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

  • Sajid
    • DEV MAN’s Sidekick

    Hi @srikanth

    Hope you are doing good today :slight_smile:

    now the theme is not available for my network site either.

    You mean on your main website/blog ?

    You are logged in as super admin ? As a superadmin you should be able to activate/deactivate any theme or plugin on your entire network.

    Choosing a level which has only my network site is making the theme visible for all levels even though its not activate-able.
    If you have selected none. Then no one can see this theme/plugin on your network except super admin. If you have selected a level then it will be listed under themes but only members having that level or above can activate it.

    If you you want to remove the theme from subsites regardless of members or levels then add below code in mu-plugins file.

    Here is a complete guide to use an mu-plugin.
    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    add_filter( 'wp_prepare_themes_for_js', 'hideThemes');
    function hideThemes($arr){
    
    	if(!is_main_site()){
    		unset($arr["twentyfourteen"]);
    		unset($arr["twentythirteen"]); // Remove these line if you only want to remove one theme
    		unset($arr["twentytwelve"]); // Remove these line if you only want to remove one theme
    	}
    
        return $arr;
    }

    Download the attached mu-plugin file, extract it, edit the file and replace the theme name (twentyfourteen) with your own theme name that you want to hide and upload to mu-plugins folder (as described in manual).

    You can find theme name in wp-content/themes/yourtheme (see screenshot).

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.