Rename wp-login.php
[resolved] is_admin() and OOP (5 posts)

  1. Stefan
    Posted 2 years ago #


    thank you for the plugin!

    Is it possible to setup this nice plugin in to a oop version. it would be much more safer and it will come with an professional look. :)

    second: there is a is_admin() behavior: if i will access (not logged in) to /wp-admin/ your plugin creates an 404(). but we are in a is_admin() situation, so some of my scripts which i only will load in the frontend, wont show up and generates some ugly errors.

    for example: if you load in your functions.php like that:

    if( !is_admin() ) { load_some_css() }

    in your 404, those css files wont ever load, because technically, your in admin mode. :) is it possible, to redirect permanent to a another link, so we run out of the admins area?


  2. Ella Iseulde Van Dorpe
    Plugin Author

    Posted 2 years ago #

    Thank you!

    Yes, I'll do that at some point.

    Could you explain your second situation with more detail? Can you give a specific example?

  3. Stefan
    Posted 2 years ago #


    create a php file "class.php", insert something like ( class fun {} )

    in your functions.php, add:

    if( !is_admin() ) { include('class.php'); }

    open your 404.php, add:

    $fun = new fun();

    now, try your 404 while type http://www.example.com/xxxx (not existing page), into your browser: your 404 will show up correctly.

    now log off and type http://www.example.com/wp-admin/ into your browser:

    404 shows up, but with an error like "cannot find class "fun". because /wp-admin actually is "is_admin();

    its a stupid example, but i hope u'll see what i mean. :)


    second thought on the 404 problem. If you have a multisite installed, user can be added via the backend in several ways. they will retrieve some confirmation mails - with the wrong url in it (/wp-admin).

    because we can't change the admin_url, i've added into your rwl_404() function:

    if (
        isset( $_SERVER['HTTP_REFERER'] ) &&
       (     strpos( $_SERVER['HTTP_REFERER'], 'newbloguser' ) !== FALSE
         || strpos( $_SERVER['HTTP_REFERER'], 'wp-activate.php' ) !== FALSE )
      ) {
         wp_redirect( rwl_login_url() );

    i know, this is not save, but at the moment, the best solution. so user wont land on a 404 page, if they click the login link.

  4. Ella Iseulde Van Dorpe
    Plugin Author

    Posted 2 years ago #

    Thanks for pointing this out. You could use ! is_admin() || is_404() and it should work. There's just no way to filter is_admin()… I'll think about it, but I don't think it can be fixed.

    I know about those multisite problems, I'll try to address them by the next release!


  5. Ella Iseulde Van Dorpe
    Plugin Author

    Posted 2 years ago #

    wp-admin now just shows you a wp_die message if you're not logged in. That should solve these issues. In the next version I'll introduce some filters to redirect to a custom url.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Rename wp-login.php
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.