Require admin approval for new WordPress user registrations

Published Updated 3 min read

WordPress registration has two settings: open or closed. Open it under Settings > General and anyone with an email address gets an account and can log in the moment they submit the form. Close it and every account is created by hand in the admin. There is nothing in between.

A community site for local event organisers, a school intranet, a B2B supplier portal: each wants a signup form that works and a person who reviews every application before the account goes live. WordPress has no way to hold a registration in a pending state.

The plugin creates the account with a role that can do nothing, emails you the details with approve and deny links, and shows the person a clear pending message if they try to log in early. Approval makes them a subscriber and sends a welcome email. No third-party service is involved.

Open, closed, or a whole membership suite

With registration open, every new account gets the Default User Role, usually subscriber, and can log in straight away. The only native brake is turning registration off and adding people yourself from Users > Add New.

BuddyPress and MemberPress both include approval flows, but each brings far more with it: profile pages, activity streams and membership tiers in one case, content restriction and payment gates in the other. If an approval gate is all you need, either installs machinery you will never use.

A role that can do nothing

Every new registration is given a custom role, pending_user, with no capabilities. The account exists in the database but cannot reach anything on the site.

WordPress's own registration email is replaced. Instead of the password setup message, the new user is told their account is under review and they will hear back once it is approved. If they try to log in before then, they see: Your account is pending admin approval. You will receive an email once it has been reviewed. That is a different message from the wrong-password error, so nobody wonders whether they mistyped.

Approving from your inbox

Each signup sends you an email with the person's name and address and two links, Approve and Deny, each signed with a nonce. Approve promotes the account to subscriber and emails the user a welcome message with a link to the login page. Deny leaves the account with no role and sends a short note. The account itself stays in the database; deleting it is a separate step from the Users screen.

When anyone is waiting, the Users screen shows a notice with the count and a link that filters the list to the pending role, so you can work through them in bulk. Adding ?role=pending_user to the users.php URL gets you there too.

Shop customers get held too

The plugin hooks user_register, which fires for every registration, including accounts created during WooCommerce checkout. On a shop, paying customers would land in the pending queue as well, which is rarely what you want.

A follow-up message can add a check that skips the pending step when registration comes from checkout. The other common additions are extra signup fields, such as a company name and a short reason for joining, included in your notification email, and a daily digest of pending accounts in place of one email per signup.

What you get

Included

  • Custom pending role assigned to all new registrations, with no capabilities until approved
  • Admin email notification with one-click approve and deny links for each new signup
  • Login block for pending accounts with a status-specific message instead of a generic error
  • Admin notice on the Users screen with pending count and a direct filter link

Not included

  • Custom registration form fields beyond username, email, and password
  • Frontend login page: still uses wp-login.php
  • Invitation codes or token-based registration gating
  • Automatic account deletion on denial
  • WooCommerce checkout registration: customers would also go through the approval step unless customised

Questions

Does this work with custom registration forms, not just wp-login.php?

Yes. It hooks user_register, which fires whenever any code path creates a user. Theme registration forms, shortcode forms and plugin-generated flows all trigger it.

Will existing users be affected when the plugin is activated?

No. Only accounts created after activation get the pending role. Existing subscribers, editors and administrators are untouched.

What if an approved user never got the email?

Once they are a subscriber, they can use the forgot password link at wp-login.php to set a password. Approval handles the role; WordPress handles the password.

Build it in Steem

The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.

Build this pluginAbout 55 credits. The free plan includes enough for one.
Read the prompt (562 words)

Build a WordPress plugin called Pending Registration Approval. Plugin Name: Pending Registration Approval. Description: Holds new user registrations in a pending state until an admin approves or denies them. Single PHP file. No external dependencies. On activation (register_activation_hook), call add_role('pending_user', 'Pending User', []) if the role does not already exist. On deactivation (register_deactivation_hook), do two things in order: query all users with the pending_user role using WP_User_Query and set each to subscriber using wp_update_user, so no accounts are stranded without a role; then call remove_role('pending_user'). Hook into user_register at priority 10. In the callback: (1) Call wp_update_user(['ID' => $user_id, 'role' => 'pending_user']) to override the default role assignment. (2) Add a one-time filter on wp_new_user_notification_email that returns an array with 'to' set to '' to suppress the default user email. Add a one-time filter on wp_new_user_notification_email_admin that returns an array with 'to' set to '' to suppress the default admin email. These filters must remove themselves after firing. (3) Retrieve the WP_User object with get_userdata($user_id). Send the registering user a custom email via wp_mail: to their email address, subject '[' . get_bloginfo('name') . '] Your registration is under review', body explaining their account is awaiting admin review and they will receive an email once it has been approved. (4) Build an approve URL using wp_nonce_url(admin_url('admin-post.php?action=preg_approve&user_id=' . $user_id), 'preg_approve_' . $user_id). Build a deny URL using wp_nonce_url(admin_url('admin-post.php?action=preg_deny&user_id=' . $user_id), 'preg_deny_' . $user_id). Send the admin an email via wp_mail: to get_option('admin_email'), subject '[' . get_bloginfo('name') . '] New registration pending approval: ' . $user->user_login, body including the username, email address, and registration time, followed by the approve URL and deny URL on separate labelled lines. Hook into authenticate at priority 30. If the passed value is a WP_User instance and in_array('pending_user', (array) $user->roles) is true, return a new WP_Error with code 'account_pending' and message 'Your account is pending admin approval. You will receive an email once it has been reviewed.' Register admin-post handlers using add_action('admin_post_preg_approve', ...) and add_action('admin_post_preg_deny', ...). Both handlers must: read user_id from $_GET using absint; verify the nonce using check_admin_referer; check current_user_can('manage_options') and call wp_die with a permission error if not. The preg_approve handler: call wp_update_user(['ID' => $user_id, 'role' => 'subscriber']); retrieve the user with get_userdata; send them an email via wp_mail: subject '[' . get_bloginfo('name') . '] Your account has been approved', body confirming their account is active with a login link built from wp_login_url(); redirect to admin_url('users.php?preg_action=approved') using wp_safe_redirect then exit. The preg_deny handler: call wp_update_user(['ID' => $user_id, 'role' => '']); retrieve the user with get_userdata; send them an email: subject '[' . get_bloginfo('name') . '] Your registration was not approved', body stating their registration was not approved and they may contact the site administrator with questions; redirect to admin_url('users.php?preg_action=denied') using wp_safe_redirect then exit. Add an admin_notices hook. Only when the global $pagenow equals 'users.php' and is_admin() is true. Query users with the pending_user role using new WP_User_Query(['role' => 'pending_user', 'fields' => 'ID']). If get_total() is greater than zero, output a div with class notice notice-warning and a paragraph reading: '{n} user registration(s) are pending your approval.' where {n} is the total count, with a link to admin_url('users.php?role=pending_user') with link text 'Review pending accounts'. If $_GET contains preg_action set to 'approved', also output a dismissible div with class notice notice-success containing 'Account approved and the user notified.' If preg_action is 'denied', output 'Registration denied and the user notified.'