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 8590207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:14:33+00:00 2026-06-11T23:14:33+00:00

All plugins works, but in my custom plugin $wpdb, wp_create_user, wp_insert_user doesn’t works. For

  • 0

All plugins works, but in my custom plugin $wpdb, wp_create_user, wp_insert_user doesn’t works.
For example, doesn’t work

$user_id = 1;
$website = 'http://wordpress.org';
wp_insert_user( array ('ID' => $user_id, 'user_url' => $website) ) ; 


global $wpdb;
if(!isset($wpdb)) {
     require_once('../../../wp-config.php');
     //require_once('../../../wp-load.php');
     require_once('../../../wp-includes/wp-db.php');
}
   $insertUser = "INSERT INTO $wpdb->users (user_login, user_pass, user_email, user_url) VALUES ('123', '123',     'rokk@gmail.com', 'lasad.com')";
    $wpdb->query( $insertUser );
  • 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-06-11T23:14:34+00:00Added an answer on June 11, 2026 at 11:14 pm

    Your reference to the user table is incorrect.

    Under your declaration of global $wpdb;
    try this

    $wpdb->wp_users = 'wp_users'
    

    and then in your sql,

    instead of using the reference $wpdb->users in your query, use:

    $wpdb->wp_users
    

    you can use this for any wordpress table, just make sure you are naming your table correctly, double check the table names in phpmyadmin

    But for your case Id avoid doing this insert and use the wordpress function
    http://codex.wordpress.org/Function_Reference/wp_create_user
    Try out the example there. It contains essential checks that you need to do before entering a new user, such as if they already exist/duplicate user names. And will automatically set things like the User_Id number, and randomize your password so it isnt shown in plain text.

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

Sidebar

Related Questions

I'm using Thickbox 3.1 with jQuery 1.3.2 with the Validation plugin and all works
All, I am trying to use JQuery's URL Validator plugin. http://docs.jquery.com/Plugins/Validation/Methods/url I have a
I want to make a jira plugin that works like a workflow validator, but
Right guys, all autocomplete plugins and functions that I've found, they only update upon
We have an svn project that also has several plugins in vendor/plugins - all
There are some Wordpress plugins for permanent redirection of all 404's to the main
I am developing python plugins for QGIS . I am listing all the database
I'm trying to create plugins for Umbraco 5. I see in all examples mention
Assuming all my Gradle plugin user going to have a MYAPP_HOME sys variable set
The jQuery Treeview Plugin adds Collapse All, Expand All and Toggle All links to

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.