Use the global $pagenow
, which is a common global set by WordPress at runtime:
if ( $GLOBALS['pagenow'] === 'wp-login.php' ) {
// We're on the login page!
}
You can also check the type of login page, for example registration:
if ( $GLOBALS['pagenow'] === 'wp-login.php' && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] === 'register' ) {
// We're registering
}
Following code is considered legacy and should not be used (wp-register.php
was deprecated & subsequently removed quite a while back):
if ( in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) )
run_my_funky_plugin();
Related Posts:
- How to redirect login and register pages
- Could be a namespace conflict (?) with login form and register form on the same page
- Conditional tag to check if ‘page.php’ is being used?
- Customizing the URLs of WordPress Login and Sign-up Pages?
- Associate Page with User
- conditional tags- how to use with shortcodes
- Google Analytics tracking code on just one page?
- Edit page shown after login in WordPress?
- Bad pages redirection
- logout redirect only from admin page
- get_permalink not fetching correct pages
- 404.php only works if I’m logged in. Everybody else redirects to wp-login.php – why?
- Show content if page is a grandchild of top level page
- Custom page only editable by one user
- WordPress redirects to login page when I enter url.com/index.php
- Newbie question. Login/Registration. New PHP page
- Make wordpress pages accessible for Woocommerce logged in users only
- Search Page: activate html code if the tag is on the page
- Post id(login page) not found
- Displaying Content Only in Certain Page IDs Not Working
- Adding CSS styles to Admin Area PAGES only (not POSTS or CPT)
- How can a user login on a wordpress page?
- Add infinite scroll to content splitted post
- How to get current page ID outside the loop?
- Contact Form on WordPress Sites?
- Page returns 404 with POST variables, but not without
- Custom templates not showing up in template dropdown
- Get page id by template
- Using pre_get_posts on true pages and static front pages
- Get the content of a specific page (by ID)
- How to get page title with the page ID?
- Show more than 20 items in pages or posts edit dashboard
- Allowing user to edit only certain pages
- Separate registration and login for different roles
- SSO / authentication integration with external ‘directory service’
- How to display last 3 posts (recent posts) in a static page?
- How to give paged links custom title?
- How to set post slug when using wp_insert_post();?
- How can I keep the content of my pages version controlled?
- How to load javascript on custom page template?
- How to configure WordPress to handle 75,000 pages?
- How to prefill WordPress registration with social details
- How to update page status from publish to draft and draft to publish
- Check if is on child-page of a particular page
- Change page template programmatically ?
- How to disable posts and use pages only
- featured image as background image on pages
- Check IF is a “single product page” and Check the “role” for a Redirect
- A check for if is parent page, if has children, if has grandchildren
- How to load JS and CSS only on specific Pages using is_page()?
- Listing pages which uses specific template [duplicate]
- How to change “You must be logged in to post a comment.”
- Proper way to get page content
- Access the same page from multiple urls (wildcard)
- Create a page without adding a page in the Database
- Is there a way to change the default page template selection?
- Can I have two child pages of different parents with the same name?
- What methods to use to create small, editable pieces of text for static pages?
- Show Default Editor on Blog Page ( Administration Panel )
- Hide page visual editor if certain template is selected?
- What is the difference between $paged and $page?
- WordPress auto login after registration not working
- multi page password protection
- Create a “Dummy” parent page for a hierarchy in page listing?
- How do I convert a page’s title to lower case?
- Get top level page parent title
- How to add a specific widget to only 1 page?
- Restrict admin access to certain pages for certain users
- page title, parent tilte and grand parent title
- How to add jQuery script to an individual page?
- Woocommerce registration page [closed]
- WordPress page edit does not save selected template
- Add a Page without header and menus?
- What is an alternative to get_page_by_title()?
- Password protect page with multiple passwords
- Create pages automatically if they don’t exist
- Find empty pages or pages which have less than x characters
- WordPress registration message
- Allow only new sub-pages to be created
- Set page template automatically based on parent
- how to display the wordpress login and register forms on a page?
- Editing Complex Pages in Visual Mode
- How build a custom login/register form with error handling?
- Link section within page with slash (/) and not hash (#) without reloading the page
- Creating a template using a specific slug name, for a page with a parent page
- Can I display submenus in groups, using wp_list_pages?
- Is there a default template file for child pages / subpages?
- Get wp_get_attachment_url outside of loop
- Order by menu_order and title?
- Require title for pages
- WP Page and Subdirectory with same name
- Replace Dashes Before Title in Page List
- Add a new page to wordpress programmatically
- Get Permalink for the top level parent of child pages
- Proper method to restrict non logged users into certain pages
- How to remove the WordPress logo from login and register page?
- How to redirect on particular page in wordpress? [closed]
- Get page id by title?
- Login email after registration never sent or received
- What is the use of $page_title and how to use it?