How to use a main site wp-admin url for all sub-sites

Hi there.

Is there a way we can use a default url like /wp-admin for all sub-sites, instead of sub-site1/wp-admin and sub-site2/wp-admin?

All sign-ups and logins would be made always on the main site: cloudstore.pt/backend for example.

Any ideas? Thanks for your help. :slight_smile:

  • Rupok
    • Support Ninja

    Hi Urbano

    Hope you had a wonderful day.

    Is there a way we can use a default url like /wp-admin for all sub-sites, instead of sub-site1/wp-admin and sub-site2/wp-admin?

    Can you please describe your requirement a little more? Do you want to redirect your users to main site login page when they arrive on subsite login page? I could give you specific instructions if I was clear about your requirements.

    All sign-ups and logins would be made always on the main site

    In any normal WordPress Multisite configuration, user registration from all subsites are redirected to main site registration page. Is it not the scenario on your site? Would you mind allowing Support Access so we can have a closer look at this?

    To enable support access you can follow this guide here:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Have a nice day. Cheers!

    Rupok

  • Urbano
    • Design Lord, Child of Thor

    Hi there Rupok, thank’s for your answer.

    I just remembered we are also using WooCommerce, so let me try to clarify our goals:

    – New Sub-Sites are created from the main-site – working good.

    – Sub-Site Administrators Login from main-site/wp-admin website.

    – Sub-Site WooCommerce Customers users Login at the sub-site.

    At this point, when Sub-Site Administrators Login from main-site/wp-admin they get a message saying “there are no permission to access the main-site”, since they are Admins of a Sub-Site only.

    Also, we would like to change /wp-admin URL to another, but I already posted a ticket about this at the following link: https://premium.wpmudev.org/forums/topic/how-to-rename-wp-admin-url-to-another.

    I have also granted support access, looking forward to hear from you.

    Cheers! :slight_smile:

  • Jaxom
    • Dragon Rider

    Hi

    I don’t understand why you would need to hide your wp-admin folder.

    There are a couple of plugins that do it for you but as it has no security issues and any hacker will find the folder no matter what you call it if they really want to.

  • Ash
    • WordPress Hacker

    Hello @Urbano

    I hope you are doing good.

    At this point, when Sub-Site Administrators Login from main-site/wp-admin they get a message saying “there are no permission to access the main-site”, since they are Admins of a Sub-Site only.

    In that case, every new registered users have to be user of main site. In that case, you can try this plugin: https://wordpress.org/plugins/multisite-user-management/

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

    Cheers

    Ash

  • Urbano
    • Design Lord, Child of Thor

    Thanks for your feedback @aknath707

    We don’t want to give access to main-site to sub-site administrators. Is there a work around to avoid that message and redirect automatically to the right Sub-Site Admin panel?

    Looking forward to hear from you. :slight_smile:

  • Rupok
    • Support Ninja

    Hi Urbano

    Hope you had a wonderful day.

    I just searched for your solution and found a user who claims this is working for him (https://wordpress.org/support/topic/force-redirect-users-to-respective-sub-site). You need to create a MU Plugin for this. For creating a mu plugin, create a folder named “mu-plugins” inside your “wp-content” folder. Then inside that “mu-plugins” folder, create a file with any name and with a .php extension. Now paste the code inside that file and save.

    <?php
    function redirect() {
    if(is_user_logged_in()&& ($user->ID = 1)) {
    global $current_user;
    get_currentuserinfo();
    if ( !is_user_member_of_blog( $current_user->ID ) ) {
    $blog = get_active_blog_for_user($current_user->ID);
    $blog_url = $blog->siteurl;
    wp_redirect ($blog_url);
    }}}
    add_action('wp_head', 'redirect');
    ?>

    Can you please try this and confirm if it works for you?

    For getting more idea on mu plugins, you can go through this article: https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    I’m looking forward to hear from you and resolve this issue as soon as possible.

    Have a nice day. Cheers!

    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.