Title: WP core function to insert or update password
Last modified: March 17, 2020

---

# WP core function to insert or update password

 *  [sayze35](https://wordpress.org/support/users/sayze35/)
 * (@sayze35)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/wp-core-function-to-insert-or-update-password/)
 * What is the best way (ie. secure way) to insert a new user into a WP database
   with WP functions?
 * 2nd question:
    I have WP Site 1 and need to insert a newly created user from 
   WP Site 1 into WP Site 2. How would you do that? I can connect to the WP Site
   2 database via “new wpdb()” and just insert the same user email/password that
   was inserted into WP Site 1.
 * I’m assuming there is a correct way and a wrong way to do that.
    Your thoughts?
 * Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Carike](https://wordpress.org/support/users/carike/)
 * (@carike)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/wp-core-function-to-insert-or-update-password/#post-12551089)
 * It is inadvisable to adjust the core functionality related to password management.
   
   Here is a database of hooks: [https://adambrown.info/p/wp_hooks](https://adambrown.info/p/wp_hooks)
 * As for Question 2, if you are not an experienced developer, the safest way is
   likely to use a plugin.
    This one came up on Google, I have not used it myself:
   [https://wordpress.org/plugins/share-logins/](https://wordpress.org/plugins/share-logins/)
 * You may also like to read these:
    [https://developer.wordpress.org/rest-api/reference/users/](https://developer.wordpress.org/rest-api/reference/users/)
   [https://kinsta.com/blog/share-logins-wordpress/](https://kinsta.com/blog/share-logins-wordpress/)
 *  Thread Starter [sayze35](https://wordpress.org/support/users/sayze35/)
 * (@sayze35)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/wp-core-function-to-insert-or-update-password/#post-12551151)
 * Hi carike,
    Is there a difference between using REST API and writing my own code
   in a webhook to insert the user via php/mysql? Is a mysql statement with a password
   not secure, good way to insert a new user on a different site?
 * the negatives with rest-api, that I’ve found:
    – it seems much more complicated?
   more issues to deal with – need to use a plug due to user not having rights to
   insert (post) – many plugins dealing with this are old or not trusted? – examples
   for complete scripts for rest api are few and far between… can’t comprehend why
   WordPress doesn’t provide some? As in the documentation is very limiting.
 * thanks
 *  [Carike](https://wordpress.org/support/users/carike/)
 * (@carike)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/wp-core-function-to-insert-or-update-password/#post-12552215)
 * > need to use a plug due to user not having rights to insert (post)
 * The REST team is working on a native (core) authorization alternative to cookie
   authorization as a goal for this year, but I don’t expect that will be ready 
   before next year.
 * > writing my own code in a webhook to insert the user via php/mysql
 * How would you be transmitting the information from the one site to the other?
   
   You would need some form of API.
 * > [https://kinsta.com/blog/share-logins-wordpress/](https://kinsta.com/blog/share-logins-wordpress/)
 * Have you had a look at that article?
    The way that they do it, rather than sending
   a user’s info from one site to another (and trying to secure that), either via
   the REST API, or some other method, is to actually have the two sites share the
   same wp_users table.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WP core function to insert or update password’ is closed to new replies.

## Tags

 * [new-user](https://wordpress.org/support/topic-tag/new-user/)
 * [password](https://wordpress.org/support/topic-tag/password/)
 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Carike](https://wordpress.org/support/users/carike/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/wp-core-function-to-insert-or-update-password/#post-12552215)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
