fauzanjeg

Disable user registration in wp-admin to prevent spam registers

May 10th, 2021
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. /** Diable User Registration Link in WP-Admin */
  2. add_filter( 'register', 'jnews_remove_registration_link' );
  3.  
  4. function jnews_remove_registration_link( $registration_url ) {
  5.     return __( 'Manual registration is disabled in this page.', 'jnews' );
  6. }
  7.  
  8. /** Diable User Registration in WP-Admin */
  9. add_action( 'init', 'jnews_redirect_registration_page' );
  10.  
  11. function jnews_redirect_registration_page() {
  12.     if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' ) {
  13.         ob_start();
  14.         wp_redirect( wp_login_url() );
  15.         ob_clean();
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment