Forked from louisreingold/gist:1ef75e6b3623c5c66e4443dc762bfd52
Last active
January 14, 2022 16:25
-
-
Save Garconis/0de7d59ed6ddee44978ec0120e7fe000 to your computer and use it in GitHub Desktop.
WP All Import | Code to run in Function Editor during import, to add hashed password (from previous export) into password field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://www.youtube.com/watch?v=VEzAWMCwprQ | |
add_action( 'pmxi_saved_post', 'post_saved', 10, 1 ); | |
function post_saved( $id ) { | |
global $wpdb; | |
$pass = get_user_meta( $id, 'xfer_user_pass', true ); | |
$table = $wpdb->prefix . 'users'; | |
$wpdb->query( $wpdb->prepare( | |
" | |
UPDATE `" . $table . "` | |
SET `user_pass` = %s | |
WHERE `ID` = %d | |
", | |
$pass, | |
$id | |
) ); | |
delete_user_meta( $id, 'xfer_user_pass' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment