0

I would like to display a custom welcome page when a user with a specific role is connected instead of profile.php page.

I created a redirection. All work fine.

function wpse_redirect_profile_access(){
        if (current_user_can('manage_options')) return '';

        if (strpos ($_SERVER ['REQUEST_URI'] , 'wp-admin/profile.php' )) {
            wp_redirect ( home_url( 'wp-admin/welcome.php' ));
            exit();
        }

}

add_action ('init' , 'wpse_redirect_profile_access');

enter image description here

I created a welcome.php page with :

<?php

/**
 * Edit user administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

echo 'Welcome';

But I lost all dashboard links/informations.

How can I keep all informations/links of my dashboard ?

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.