When I enter http://example.com/wordpress/wp-admin
it is redirecting to wp-login.php
page.
I checked the index.php
of the wp-admin folder and checked the file, it is including wp-config.php
, wp-settings.php
, wp-load.php
of the root folder and some files in wp-include
folder but I am unable to figure out which function is redirecting the wp-login.php file while entering http://example.com/wordpress/wp-admin
. I even checked auth_redirect()
function.
2 Answers
Each call to an admin page loads the \wp-admin\admin.php
file.
For example, from the \wp-admin\index.php
file:
/** Load WordPress Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );
In that file auth_redirect()
is called.
From \wp-admin\admin.php
:
require_once(ABSPATH . 'wp-admin/includes/admin.php');
auth_redirect();
// Schedule trash collection
if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )
wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
set_screen_options();
auth_redirect()
does the redirect. From the inline docs:
/**
* Checks if a user is logged in, if not it redirects them to the login page.
*
* @since 1.5
*/
function auth_redirect() {
[...]
$login_url = wp_login_url($redirect, true);
wp_redirect($login_url);
exit();