WordPress.org

Ready to get started?Download WordPress

Forums

How to exclude wp-login.php from loading scripts (3 posts)

  1. Looimaster
    Member
    Posted 3 years ago #

    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?

  2. Curtiss Grymala
    Member
    Posted 3 years ago #

    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
    }
  3. Looimaster
    Member
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.