Which of the following is the correct way to redirect the default login and registration page URL to a custom login and registration page URL?

By ·
Which of the following is the correct way to redirect the default login and registration page URL to a custom login and registration page URL?
Answers:
1.      add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { return(‘Your custom url’); exit(); } }
2.      add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_redirect(‘Your custom url’); exit(); } }
3.      add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { redirect(‘Your custom url’); exit(); } }

4.      add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_return(‘Your custom url’); exit(); } }
GA
Gaurav Arora, Digital Media Lead. 10+ years running paid media and tracking for brands in the USA, UK and Canada.