0

I found almost the same question here - Remove dashboard, use Pages tab as default

and I tried to implement it for my own needs and couldn't get it to work.

I am doing a hotel site and I am making a dashboard for the hotel workers. I have it set so there is only the booking plugin available in the dashboard menu, but I would like it to show the "all bookings" page (not the default, widgets, as they don't need any). I tried this as the code (below) and it didn't work - The url I took from after clicking on the submenu item "all bookings" (I also tried edit.php?post_type=mphb_booking) and the user I got from inspecting the Hotel Manager role in Users. Any help is appreciated.

function dashboard_redirect($url) {
    global $current_user;
    // is there a user ?
    if(is_array($current_user->roles)) {
        // check, whether user has the author role:
        if(in_array('mphb_manager', $current_user->roles)) {
             $url = admin_url('edit.php?post_type=mphb_booking&uipid=637');
        }
        return $url;
    }
}
add_filter('login_redirect', 'dashboard_redirect');

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.