Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Ella

    (@ellatrix)

    The plugin used to do this, but there were some problems because wp-admin is defined early as the admin area… So some themes using IS_ADMIN had problems with their 404 page… I’ll think about a way to circumvent this, but for now it will stay like this…

    Thread Starter farlane

    (@farlane)

    Thanks – it’s a great plugin!

    Vakula

    (@vakula)

    Hello,

    On my site the 404 is great work for wp-amdmin.
    Please make the option to chose the user that he needs (use 404 or “You must log in to access the admin area”).

    Thank you for the great plugin!

    Janneke,

    This is an excellent plug-in, thanks! I’d also like to request the option to redirect the wp-admin folder to a 404 page. If the purpose of the plug-in is to obfuscate the use of WP on a site, then this option would help to do that.

    After you install new plugins Rename-wp-login, than anyone try to login your admin area, eg.riyofurniture.com/wp-admin, they will find “You must log in to access the admin area.” Its call WP DIE.
    Here, trick to modify error message above with new message that you want ( check this link: https://www.riyofurniture.com/wp-admin )
    – Download wp-content/plugins/rename-wp-login.php
    – Open wp-content/plugins/rename-wp-login.php
    – Go to line 445 : wp_die( __( ‘You must log in to access the admin area.’ ) );
    – Rewrite your own message on ‘You must log in to access the admin area.’
    – Save than upload
    – Check / refresh your browser, your own message going on.

    function restrict_admin_area() {
        if ( !is_user_logged_in() && $_SERVER['PHP_SELF'] != '/wp-admin/admin-ajax.php' ) {
            wp_redirect( site_url() ); exit;
        }
    }
    
    add_action( 'admin_init', 'restrict_admin_area' );

    put that in your theme’s functions.php. it would redirect users if they try to access the admin area, while not being logged in.

    you could also simply produce a 404 there.

    @markus That code doesn’t seem to work. I still get the default “You must log in to access the admin area”.

    based on HartokoEdo’s answer;
    – Open wp-content/plugins/rename-wp-login.php
    – Go to line 445 and change:

    wp_die( __( ‘You must log in to access the admin area.’ ) );

    to

    wp_redirect( home_url(‘error’) ); exit;

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘"You must log in to access the admin area."’ is closed to new replies.