WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is probably very simple, but I would like to add a hook to my theme's functions.php file in order to change the Register link on the login page (wp-login.php).

How would I do that?

share|improve this question

Let's follow the white rabbit.


...can't be changed, it's hardcoded. However it leads to here when clicked:


...which has a wp_signup_location filter for multisite, which in case your site !is_multisite() will never fire off. If you're multisite - stop here.

add_filter( 'wp_signup_location', 'wpse_46848_hijack_the_back' );
function wpse_46848_hijack_the_back( $location ) {
    return 'my-registration-page-is-better.php';

Not multisite, eh?

registration_redirect is what happens AFTER registration, yet it's called before displaying the registration page. We can play dirty and hook into it and diverge into a wp_redirect with an exit() before displaying anything from the original page.

add_action( 'registration_redirect', 'wpse_46848_hijack_the_back' );
function wpse_46848_hijack_the_back( $redirect_to ) {
    wp_redirect( 'my-registration-page-is-better.php' );

Note, that both add_action and add_filter work in the same way (add_action calls add_filter), and although it's generally not advisable to mix them as things will get confusing, semantically you're hijacking with the filter with an action, not a filter (since you're not returning anything). If you prefer to stick to strict "a filter is a filter, an action is an action" rules do this:

add_filter( 'registration_redirect', 'wpse_46848_hijack_the_back' );
function wpse_46848_hijack_the_back( $redirect_to ) {
    wp_redirect( 'my-registration-page-is-better.php' );
    return exit();
share|improve this answer
Great answer! Thank you! – moonvader Jul 5 at 10:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.