Wordpress - how detect if current page is the login page

后端 未结 4 1626
生来不讨喜
生来不讨喜 2021-02-05 06:39

There is a better way than using global variable $pagenow to detect current page if is login page, like a is_admin() ?

if ($pagenow !=          


        
4条回答
  •  轮回少年
    2021-02-05 07:08

    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/

提交回复
热议问题