LoginSignup
0
0

More than 3 years have passed since last update.

ftp通信でwordpressのユーザーをゴリ押し作成

Last updated at Posted at 2019-11-23

備忘録
※結構ゴリ押し技
※参考元→https://cunelwork.co.jp/blog/web/user_register/

-FTP通信はできるけどwpのパスワードを忘れた人

初っ端に盛り込む

wp-content/themes/テーマ/header.php
<?php
    // 設定
    $user_login = 'admin'; // ログインID
    $user_pass = 'password'; // ログインパスワード
    $user_email = 'hoge@example.com'; // メールアドレス
    $role = 'administrator'; // 権限を管理者に

    // ログインユーザーの登録
    if (!username_exists($user_login)) {
        $data = array(
            'user_login' => $user_login,
            'user_pass' => $user_pass,
            'user_email' => $user_email,
            'role' => $role
        );
        wp_insert_user($data);
    }
?>

1.ftpで上記をアップロード
2.サイトにアクセスするとheader.phpが一度読み込まれるので上記コードが実行されて、ユーザー作成完了
3.正式な手続きでユーザーを作成して、上記を削除したheader.phpを削除(必ず)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0