1
如何以編程方式創建WordPress用戶?Wordpress,以編程方式創建用戶
我正在使用下面的方法,用戶正在創建 - 但是當我嘗試用密碼登錄它給了我錯誤的密碼信息,請有任何建議嗎?
include 'wp-blog-header.php';
include 'wp-includes/registration.php';
include 'wp-includes/pluggable.php';
ini_set("memory_limit","1024M");
ini_set("max_execution_time", "240");
global $wpdb;
programmatically
$row = array(
'user_name' => "wacek123",
'password' => "wacek123",
'email_address' => "[email protected]",
'name' => "wacek123",
'surname' => "wacek123"
);
$userdata = array(
'user_login' => $row["user_name"],
'user_pass' => wp_hash_password($row["password"]),
'user_nicename' => $row["user_name"],
'user_email' => $row["email_address"],
'first_name' => $row["name"],
'last_name' => $row["surname"],
'role' => 'subscriber'
);
wp_insert_user($userdata);
你試過嗎? ''password'=> md5(「wacek123」)' – user2019515