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?
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?
You must be logged in to post a comment.
Let’s follow the white rabbit.
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-login.php#L414
…can’t be changed, it’s hardcoded. However it leads to here when clicked:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-login.php#L481
…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.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 awp_redirect
with anexit()
before displaying anything from the original page.Note, that both
add_action
andadd_filter
work in the same way (add_action
callsadd_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: