There is a better way than using global variable $pagenow
to detect current page if is login page, like a is_admin()
?
if ($pagenow != 'wp-login.php' && !is_admin())
{
// Do something
}
There is a global variable $current_screen
with a getter get_current_screen()
(which declared in /wp-admin/includes/template.php
), but it's always equal to NULL
On #15686 (Detect the current page template tag) – WordPress Trac it's sayed it's usually used $pagenow
, but I think is not the good way to compare non-dynamic pages against there file name instead of there function (like admin page)
If you are like me, and you actually tried to de-register / mess with the jQuery that WordPress automatically loads, then the correct answer is:
Don't use
wp_print_styles
to register your scripts – use wp_enqueue_scripts instead!This hook will run only on the frontend, not on the login page, so there's no need for workarounds.
Nacin is explaining it here: http://make.wordpress.org/core/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/
Incase you want to be as non WP independant as possible; for instance in a plugin keeping future changes out of scope. You can use something like this:
While I tend to agree with others on the need for a function is_login_page() or something similar, I found what seems to be the best answer at https://wordpress.stackexchange.com/questions/12863/check-if-were-on-the-wp-login-page, which I used to make the following:
Can't you explain what are you going to do with it? So I can tell if you should code using wordpress hooks.
or you can use the absolute uri, just match it with wp-login.php
?>