shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Restrict Instructors Accessing the Default WP Dashboard

Altough the instructors have their own dashboard and when logged in they are taken to their overview page, there are times when either by clicking on some unwanted links or playing around with the URL, the instructor may land on the default WP dashboard page which usually displays your dashboard widgets.

This is not really a major concern as such as they mostly contain some welcome steps or some news feed from WP or other plugins and can be hidden from settings, but you still may wish that your instructor never access this page, even if it is just for the sake of avoiding confusion.

In any case, you can restrict your instructors from accessing the default WP Dashboard page and then redirecting them back to the overview page by adding the following code in either of the options below: .

  • Your child theme’s functions.php file
  • Make use of the Code Snippets add-on
/**
 * Restrict access to dashboard page for instructors
 *
 * @param object $current_screen
 * @author Kumar Rajpurohit <[email protected]>
 */
function ir_custom_instructor_redirect( $current_screen ) {
    if ( ! function_exists('wdm_is_instructor') || ! wdm_is_instructor() ) {
        return;
    }

    if ( is_admin() && ! wp_doing_ajax() ) {
        if ( $current_screen->id == "dashboard" ) {
            $redirect_to = add_query_arg('page', 'ir_instructor_overview', admin_url('admin.php'));
            wp_redirect( $redirect_to );
            die();
        }
    }
}
add_action( 'current_screen', 'ir_custom_instructor_redirect', 10, 1 );
Updated on May 21, 2020
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Was this article helpful?

shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Related Articles