あなたは次のようにすることができます:
あなたのプロジェクトのルートディレクトリにwordpressフォルダ名をblog /にしておいてください。 そしてあなたのアプリケーションのような同じ資格情報を持つwordpressユーザーを作成してください。この意志は助け
require_once('blog/wp-blog-header.php');
require_once('blog/wp-includes/registration.php');
$newusername = 'xxxxxxxxxxx';
$newpassword = 'xxxxxxxxxxx';
$newemail = '[email protected]';
// Check that user doesn't already exist
if (!username_exists($newusername) && !email_exists($newemail)){
// Create user and set role to administrator
$user_id = wp_create_user($newusername, $newpassword, $newemail);
if (is_int($user_id)) {
$wp_user_object = new WP_User($user_id);
$wp_user_object->set_role('contributor');
echo 'Successfully created new user.';
} else {
echo 'No users were created.';
}
} else {
echo 'This user or email already exists. Nothing was done.';
}
希望:あなたは新しいログインユーザを作成するときに、あなたのアプリケーションに以下のコードを入れて 。
「私のコードで何が間違っているのですか」よりも、「どうすれば解決するのか」... – RST