Skip to content

Instantly share code, notes, and snippets.

@scarstens
Created May 29, 2014 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scarstens/83afad1cce016edd63b5 to your computer and use it in GitHub Desktop.
Save scarstens/83afad1cce016edd63b5 to your computer and use it in GitHub Desktop.
Disable default registration page in WordPress by redirecting away. Has filter for custom redirection. Used to secure registrations that do not follow standard WordPress registration workflows.
add_action('init','disable_default_registration');
function disable_default_registration(){
global $pagenow;
if( 'wp-login.php' == $pagenow && $_REQUEST['action'] == 'register') {
$registration_redirect = apply_filters('disable_default_registration_redirect', site_url());
wp_redirect($registration_redirect);
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment