Support » Fixing WordPress » How to exclude wp-login.php from loading scripts

  • Mal

    (@looimaster)


    if ( !is_admin() ) { // instruction to only load if it is not the admin area
    something to load
    }

    This doesn’t work on wp-login.php page. How do I exclude it too?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m sure there’s probably a better way, but the only way I’ve been able to do so is to check the request URI, like this:

    if( !is_admin() && !stristr( $_SERVER['REQUEST_URI'], 'wp-login' ) ) {
    something to load
    }
    Mal

    (@looimaster)

    Thanks 🙂
    I’m not sure if it’s going to work with some servers that use something like:
    a) localhost:8080
    b) example.com/sub-dir/
    c) abc.example.com/~x/
    because I used $_SERVER variable a few times and it was often causing problems on untypical server configurations.

    I’m going to experiment with some similar alternatives though if no one else will come up with any better solution 🙂 Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to exclude wp-login.php from loading scripts’ is closed to new replies.