Skip to content

Instantly share code, notes, and snippets.

@NateJacobs
Last active December 11, 2015 04:28
Show Gist options
  • Save NateJacobs/4544797 to your computer and use it in GitHub Desktop.
Save NateJacobs/4544797 to your computer and use it in GitHub Desktop.
Hide all register links and redirect to custom register link. For use with TNG User Meta version 1.X. https://github.com/HeatherFeuer/tng_user_meta
<?php
/**
* Hide Default Registration
*
* This is for use with the TNG User Meta plugin: https://github.com/HeatherFeuer/tng_user_meta
* Function 1 will redirect the user to the custom registration page when they visit /wp-login.php?action=register
* Function 2 will hide all the links to the default register page. Even if the user does get there they will be redirected.
*
* @author Nate Jacobs
* @date 1/15/13
* @link https://gist.github.com/4544797
*
*/
add_action( 'login_form_register', 'tng_user_meta_register_redirect' );
function tng_user_meta_register_redirect()
{
wp_redirect( get_permalink( get_option( 'user_meta_register_start_page' ) ) );
exit();
}
add_action( 'login_form_lostpassword', 'tng_user_meta_hide_register' );
add_action( 'login_form_retrievepassword', 'tng_user_meta_hide_register' );
add_action( 'login_form', 'tng_user_meta_hide_register' );
function tng_user_meta_hide_register()
{
add_filter( 'pre_option_users_can_register', '__return_zero' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment