WordPress.org

Support

Support » Plugins and Hacks » Redirect the "Access denied…" to my 404 page?

Redirect the "Access denied…" to my 404 page?

  • 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/

  • The topic ‘Redirect the "Access denied…" to my 404 page?’ is closed to new replies.