WordPress.org

Ready to get started?Download WordPress

Forums

WP User Frontend
Redirect the "Access denied..." to my 404 page? (1 post)

  1. qzha017
    Member
    Posted 1 year ago #

    Does anyone know how to change the "Access denied" message to a 404 page instead?

    when someone (other than admin) tries to access dashboard?
    I want to change:

    Access Denied. Your site administrator has blocked your access to the WordPress back-office.

    to my 404.php page.

    the code for that message is:

    * Block user access to admin panel for specific roles
         *
         * @global string $pagenow
         */
        function block_admin_access() {
            global $pagenow;
    
            $access_level = wpuf_get_option( 'admin_access' );
            $valid_pages = array('admin-ajax.php', 'async-upload.php', 'media-upload.php');
    
            if ( !current_user_can( $access_level ) && !in_array( $pagenow, $valid_pages ) ) {
                wp_die( __( 'Access Denied. Your site administrator has blocked your access to the WordPress back-office.', 'wpuf' ) );
            }
        }

    Thanks everyone

    http://wordpress.org/extend/plugins/wp-user-frontend/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic