Skip to main content
Share Your Experience: Take the 2024 Developer Survey
39 votes

How to change the default registration email ? (plugin and/or non-plugin)

For 2018 and onwards users: Since WordPress 4.9.0 there are new filters you can use for this (no need for a plugin anymore): wp_new_user_notification_email - customise email sent to User ...
Edu Wass's user avatar
  • 701
24 votes

Check if wp-login is current page

My preferred way: if( is_wplogin() ){ ... } code: function is_wplogin(){ $ABSPATH_MY = str_replace(array('\\','/'), DIRECTORY_SEPARATOR, ABSPATH); return ((in_array($ABSPATH_MY.'wp-login....
T.Todua's user avatar
  • 5,800
14 votes

How do I create a password reset link?

After much research, I finally turned to examining the WordPress core file wp_login.php hoping that WP would show how they do it in a non-obtuse manner. From the information around line 331 (WP 4.6.1)...
ermSO's user avatar
  • 331
13 votes

What's the difference between wp_insert_user() and wp_create_user()

As per Codex The wp_create_user function allows you to insert a new user into the WordPress database. It uses the $wpdb class to escape the variable values, preparing it for insertion into the ...
e4rthdog's user avatar
  • 461
12 votes

How to set up User email verification after Signup?

You can use user_register hook add_action( 'user_register', 'my_registration', 10, 2 ); function my_registration( $user_id ) { // get user data $user_info = get_userdata($user_id); // ...
Akshat's user avatar
  • 1,197
10 votes

Placeholder text for registration form

Another simple way to do this without needing to add another script is using PHP's str_replace function. $args = array( 'echo' => false, ); $form = wp_login_form( $args ); //add the ...
renzo_cast's user avatar
9 votes

turn off new user registration emails

Approach for WordPress 4.6+ Check out the patch in ticket #36009 that was merged into WordPress version 4.6. It adds the 'user' option for the $notify input parameter of wp_new_user_notification(), ...
birgire's user avatar
  • 67.4k
9 votes

Save custom user meta on registration

You have to trigger the following hooks: user_register personal_options_update edit_user_profile_update add_action('user_register', 'addMyCustomMeta'); add_action('personal_options_update', '...
Aishan's user avatar
  • 762
9 votes

What the user_status column?

The user_status column in the wp_users table is no longer used by WordPress core - it just hasn't been removed. It may, or may not be used in the future. Best to leave it alone...
Mat's user avatar
  • 1,637
9 votes

How to auto login after registration?

Have you tried this? function auto_login_new_user( $user_id ) { wp_set_current_user($user_id); wp_set_auth_cookie($user_id); wp_redirect( home_url() ); // You can change home_url() to the ...
Sachin's user avatar
  • 106
8 votes

Check if wp-login is current page

There is a new function introduced in WordPress 6.1.0 which is is_login() which does just that.
fonpacific's user avatar
7 votes

How to add first name & last name to default registration form?

Add this code in functions.php add_action( 'register_form', 'myplugin_register_form' ); function myplugin_register_form() { $first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['...
Faysal Mahamud's user avatar
7 votes

How do I create a user using the new JSON api in 4.7?

The REST API included in WordPress doesn't actually have authentication built into it. If you do normal authentication in WordPress by logging in, then your browser will receive a set of cookies. If ...
Otto's user avatar
  • 32.6k
7 votes

How to use the WP REST API for new user registration (sign up form)?

hopefully you've found the answer already. Here's our solution, for your reference. :D The following code should add User Registration via REST API to your WordPress Website. It supports Registration ...
Jack Song's user avatar
  • 391
6 votes

User Without Email?

Using Wordpress 4.7.2, I solved this with the following hooks: // This will suppress empty email errors when submitting the user form add_action('user_profile_update_errors', '...
CGodo's user avatar
  • 181
6 votes

Get the password key when using the wp_new_user_notification_email filter

I found a function to retrieve this key : get_password_reset_key(). So now I have this code in my plugin to customize the email sent to newly registered users: add_filter('...
GuitarExtended's user avatar
5 votes

Check if wp-login is current page

More modern way to do that, it should work even when the wp-login URL is changed by plugins and when WP is in a subfolder, etc: if(stripos($_SERVER["SCRIPT_NAME"], strrchr(wp_login_url(), '/')) !== ...
Firsh -'s user avatar
5 votes

Create new user without password

Current versions of WP allow creation of a user without creating a password. Just leave password area blank, and verify no password if prompted. But, best practice might be to create user with a ...
Rick Hellewell's user avatar
5 votes

turn off new user registration emails

Generic Pluggable Approach for WordPress < 4.6 (See @birgire's Answer for > 4.6) Pluggable functions are one of the more depressing relics of WordPress's past and come with a slew of intricacies. ...
bosco's user avatar
  • 6,815
5 votes

How to send messages when a customer is registered

If you're talking about Wordpress user registration, you want to start by reading about the User Register hook: Then your code ...
TomC's user avatar
  • 1,291
5 votes

WordPress registration message

This message is not part of the WordPress core. I confirmed this suspicion by searching for the message within the WordPress core files. When it was not found, I then searched the message using a ...
Dave Romsey's user avatar
  • 17.7k
5 votes

How to add a checkbox to registration and user profile?

The extended answer... // Add the checkbox to registration form add_action( 'register_form', 'foo_add_privacy_policy_field' ); function foo_add_privacy_policy_field() { ?> <p> <...
Sasha Grievus's user avatar
5 votes

BuddyPress: Allow only one email domain to register

Finally, I found the solution. Here is the code if anyone has the same issue and want to refer it. Using Action function wf_validate_email_domain() { global $bp; $email = $bp->...
pixelngrain's user avatar
  • 1,400
4 votes

WordPress auto login after registration not working

Short answer - Your original function (mostly) works. This is your function edited to do what it needs to do: function automatically_log_me_in( $user_id ) { wp_set_current_user( $user_id ); ...
butlerblog's user avatar
  • 4,996
4 votes

How to allow more than one registered user to have the same email?

So unfortunately without major revisions to both code and database structure this is not possible because WordPress stores the user email in a "UNIQUE" row in the database. Just unsetting the error ...
Nicholas Koskowski's user avatar
4 votes

How do I check if a post is private?

Was just looking around for this answer myself in 2020 and it seems this is a great way to do it now. <?php if ( $wp_query->have_posts() ) : ?> <?php while ( $wp_query->have_posts() )...
Pocketninja's user avatar
4 votes

Adding fields to the "Add New User" screen in the dashboard

You need to do 2 things. Register fields Save fields Note: Below example works only for administrator user role. 1. Register fields For Add New User use action user_new_form For User Profile use ...
maheshwaghmare's user avatar
4 votes

How to disable wordpress confirmation email for new users

I noticed the current answers are plugin based only. You can use wpmu_signup_user_notification to achieve this without installing a plugin. Add to your functions.php - this will disable user signup ...
Liam Stewart's user avatar
4 votes

Integrating WordPress to my website, while keeping my own authentication system

WordPress's authentication system is made up of pluggable functions, which means that you can write a plugin that has a function named, say, wp_authenticate(), and your site will use your ...
Pat J's user avatar
  • 11.9k

Only top scored, non community-wiki answers of a minimum length are eligible