Support » Plugin: Rename wp-login.php » Redirect hits instead of creating a 404?

  • Resolved MeisterHundekuchen


    Hello Fellow-Users,

    I’ve just discovered this wonderful plugin to hide my login-page, so first of all: thanks for the nice work ­čÖé

    I wonder if it is possible (or more: _how_ it is possible) to redirect the foreign hits on /wp-admin/ and wp-login.php to another website like or to a local stophackingthissite.html instead of the regular 404 page.

    I’m out of coding php for some years, so i have no exact clue, but i guess you can customize the function set_404() to do something like this, correct? ­čśë

    Best regards!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ella Van┬áDorpe



    If you want I can add a hook there so you can add some code in your theme to customise the behaviour. I don’t want to add too many options on the back-end.

    hey, yes that would be great ­čÖé

    Plugin Author Ella Van Dorpe


    Actually you don’t even need a hook in the plugin. If you hook in login_init, you can redirect hits from there, but you need to hook in early enough before the plugin sets a 404. Don’t do this with a multisite though.

    add_action( 'login_init', 'your_login_init', 1 );
    function your_login_init() {
    	if ( strpos( $_SERVER['REQUEST_URI'], 'wp-login' ) !== false ) {
    		wp_redirect( '' ); die;
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect hits instead of creating a 404?’ is closed to new replies.