Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3354474
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:16:39+00:00 2026-05-18T02:16:39+00:00

This question is about WordPress cms. How to create a new admin user with

  • 0

This question is about WordPress cms.

How to create a new admin user with wanted password using a simple script, hosted on same site?

Like, we have site http://example.com/

And the script http://example.com/ourscript.php

If we open the script page, there should be created one more admin user in admin-panel.

It can be done with some mysql-query.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:16:39+00:00Added an answer on May 18, 2026 at 2:16 am

    You’ll want to do two queries:

    1.)
    insert into wp_users values('','admin_username','user_password','admin','user_email','user_url','registration_date','',0,'admin')
    
    2.)
    insert into wp_usermeta values ('','user_id','wp_capabilities','a:1:{s:13:"administrator";s:1:"1";}')
    

    You’ll need to bare a few things in mind:

    • the username must be unique
    • the password must be hashed with
      wp_hash_password()
    • the user_id in the second statement
      is the insert_id of the first
      statement.

    Here is some sample code:

    <?php
        //get required support files
            require("database.class.php");
            require("wordpress/functions.php");
    
        //build the first insert array and send
            $array['user_login'] = "james";
            $array['user_pass'] = wp_hash_password("test");
            $array['user_nicename'] = "James";
            $array['user_email'] = "me@jtgraphic.net";
            $array['user_url'] = "http://jtgraphic.net";
            $array['user_registered'] = date("Y-m-d H:i:s");
            $array['user_status'] = 0;
            $array['display_name'] = "James";
    
            $user_id = $database->insert("wp_users",$array);
    
        //build the second insert array and send
            $array['user_id'] = $user_id;
            $array['meta_key'] = "wp_capabilities";
            $array['meta_value'] = "a:1:{s:13:"administrator";s:1:"1";}";
    
            $database->insert("wp_usermeta",$array);
    ?>
    

    The database object can be found here:

    http://www.jtgraphic.net/code/database-object/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is about using getter methods of a singleton object in worker threads.
I'm developing Wordpress theme for my friend's company, but this question is all about
This question is a follow up to my previous question about getting the HTML
I was reading this question about how to parse URLs out of web pages
I just came across this question about initializing local variables. Many of the answers
I have a question about this question . I posted a reply there but
As kind of a follow up to this question about prefixes , I agree
This question is about removing sequences from an array, not duplicates in the strict
This question is about organizing the actual CSS directives themselves within a .css file.
This question is about App domains and Sessions. Is it possible to have IIS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.