wp-admin on login returns white blank page , but it turns normal if i refresh

Question

I am working on a wordpress website and i am little stuck into some situation, i added some hooks in function file like (redirect after login). Everything is working fine till now, i just get one error i.e when i login with wp-admin url it redirects or return me the blank white page insted of admin dashboard page , but it gets back to normal if i refresh that page. I turned on the WP_DEBUG to true in wp-config file and it shows me error given below :-

Notice: Undefined index: redirect_tojk in /home/bloctnpt/public_html/jobifyinc.com/newsite/wp- 
content/themes/workscout/functions.php on line 739

Notice: Undefined index: redirect_to_resume_section in 
/home/bloctnpt/public_html/jobifyinc.com/newsite/wp-content/themes/workscout/functions.php on line 
740

Notice: Undefined index: emp_dash_redirect in /home/bloctnpt/public_html/jobifyinc.com/newsite/wp- 
content/themes/workscout/functions.php on line 742

Notice: Undefined index: login_sub in /home/bloctnpt/public_html/jobifyinc.com/newsite/wp- 
content/themes/workscout/functions.php on line 744

and this is the code of my function file which give errors of the above error lines:-

function my_login_redirect( $url, $request, $user ) { 
//   print_r($_POST);
 //  echo "kk".$url;
if (current_user_can('administrator')) {
print_r($_POST); echo "kkkkk"; exit;

$url = admin_url();      
wp_redirect($url);
}
else
{


             if ($user && is_object($user) && is_a($user, 'WP_User')) {
                 $variable_two = $_POST['redirect_tojk'];
                 $variable_submit = $_POST['redirect_to_resume_section'];

                 $emp_red_dsbd = $_POST['emp_dash_redirect'];

                 $variable_login = $_POST['login_sub'];

                 if ($user->has_cap('candidate')) {
                     if (!empty($variable_two)) {
                         $url = $_POST['redirect_tojk'];
 
                         wp_redirect($url);
                         exit;
                     }
0
Jain 4 months 0 Answers 14 views 0

Leave an answer