How can I add a slug to the end of "siteurl" in this WordPress redirect plugin?

On WordPress multisite I am using the “redirect-multisite-user-to-their-own-site” plugin for users who login from the frontend to be redirected to their own specific blog. However, this plugin only redirects to the user’s blog’s homepage (e.g., rather than the dashboard (e.g. I want the user to be redirected to their dashboard.

In the plugin’s code (see below, included in full), they have wp_redirect($user_target_site->siteurl);. I don’t know PHP well yet and need it to somehow go to $user_target_site->siteurl + /wp-admin. How can I accomplish this? I am happy to edit the plugin and create my own plugin to prevent it being overridden by plugin updates.

    Plugin Name: Redirect multisite user to their own site
    Plugin URI:
    Description: If the current user in a multisite environment accesses a subsite to which access has not been granted, then redirect the user back to their own site. This plugin requires PHP 5.3 or newer because it uses PHP namespaces.
    Author: Mark Howells-Mead
    Version: 1.1.1
    Author URI:
    Text Domain: redirect-multisite-user-to-their-own-site

    namespace MHMMultisiteRedirectuser;

    class Plugin
public function __construct()
    if (is_multisite()) {
        add_action('parse_request', array($this, 'checkAccess'));

public function checkAccess()
    global $current_user, $wpdb;
    $current_site_id = (int) $wpdb->blogid;
    $user_sites = get_blogs_of_user($current_user->ID);
    if (is_array($user_sites)) {
        switch (count($user_sites)) {
            case 0:
                if (is_user_logged_in()) {
                    do_action('redirect-multisite-user-to-their-own-site/no-sites', $current_user, $current_site_id);
            case 1:
                $user_target_site = array_values($user_sites)[0];
                if ((int) $user_target_site->userblog_id !== $current_site_id) {
                    do_action('redirect-multisite-user-to-their-own-site/redirecting', $current_user, $current_site_id, $user_target_site->siteurl);
                if (!array_key_exists($current_site_id, $user_sites)) {
                    do_action('redirect-multisite-user-to-their-own-site/not-allowed', $current_user, $current_site_id, $user_sites);

    new Plugin();

Read more here: How can I add a slug to the end of "siteurl" in this WordPress redirect plugin?

Leave a Reply

Your email address will not be published. Required fields are marked *