Redirect user role to a specific page on login in a multisite network?

Here’s the solution if anyone’s interested: add_filter(‘login_redirect’, function( $url, $query, $user ) { $user_info = get_userdata($user->ID); return get_blogaddress_by_id($user_info->primary_blog) . ‘wp-admin/?login=1’; }, 10, 3); add_action(‘current_screen’, function ( $user ) { $userID = get_current_user_id(); $user_info = get_userdata($userID); if ($_GET[‘login’] == 1 && $user_info->primary_blog) { $primary_url = get_blogaddress_by_id($user_info->primary_blog) . ‘wp-admin/edit.php?post_type=visitor’; $site_id = $user_info->primary_blog; if (!current_user_can_for_blog($site_id, ‘create_users’)) { wp_redirect( … Read more

Create form which redirects to site in network?

You could perform a validation through get_blog_id_from_url($domain, $path) function, assuming you are using directories and NOT subdomains. Otherwise, $path is not required. See code and comments below. <?php if ( ! empty( $_POST[‘sitename’] ) ) { $main_site_url = network_site_url( “https://wordpress.stackexchange.com/” ); $domain = preg_replace( “/^https?:\/\/(www)?/”, ”, $main_site_url ); $path = preg_replace( “/\//”, ”, trim( $_POST[‘sitename’] … Read more

MULTISITE: Password issue and Error Cant access site

I suspect ‘credential sharing’ (and not by choice). Perhaps someone was able to get your credentials while you were logged in overnight? Another possibility is browser or site caching; so clear those. If my site, I’d change credentials everywhere (hosting, FTP, WP database, WP admin users). If necessary through myphpAdmin database access. I would then … Read more

Error establishing a database connection after moving local wordpressmultisite from one directory to another

Thanks for sharing the issues. I will share you how can you move the wp website another folder. Please follow my instruction step by step. Step 1: Copy the all source code this folder location “http://localhost/Wordpress/buddha” file. Step 2: When you copy all file then Pleas paste the all source file this folder location “http://localhost/wp-buddha“. … Read more