how can i echo the hook variable in in any template file

Question

Is there any way to echo the variable present in a hook?
i want to echo the
here below is my code

function my_login_redirect( $url, $request, $user ) {

if ( $user && is_object( $user ) && is_a( $user, ‘WP_User’ ) ) {
$variable_two = $_GET[‘redirect_to’];
if ( $user->has_cap( ‘administrator’ ) ) {
$url = admin_url();

} elseif ( $user->has_cap( 'candidate' ) ) {
      
    if(!empty($variable_two)){
      $url = $_GET['redirect_to'];
      print_r($url);
      wp_redirect($url);
    }

   // $url = home_url( '/members-only/' );
 }
 }
       // echo $url; exit; wp_redirect($url);

}
add_action( 'login_redirect', 'my_login_redirect', 10, 3 );

i wanna to echo the $url = $_GET[‘redirect_to’]; in any template file

0
fyn matt 881 4 months 0 Answers 13 views 0

Leave an answer