A new file, import.php:
<?php
define('WP_INSTALLING', true); // this is required. i forget why!
include '/path/to/wordpress/wp-load.php';
include ABSPATH . WPINC . '/registration.php'; // wp_insert_user()
$userdata = array('user_login' => 'jdoe', 'user_pass' => 'foobar');
$user_id = wp_insert_user($userdata);
Check wp_insert_user() for other possible fields. Run update_usermeta() for any additional needed meta fields. (Including user level, though there may be convenience functions.)
Note that here at work we redefine the wp_authenticate() function (it’s in pluggable.php, so it can be replaced by defining it in your own plugin) and creating user accounts on-demand if they don’t exist at login time.
Related Posts:
- Stress testing WordPress
- How do I represent ‘chunks’ of content within WordPress?
- Blog posts on one subdomain, pages on another
- Can I use wordpress for a non-blog site?
- Can I / Should I use WordPress as a CMS for my Flash application
- Hide update messages from non-admin users?
- Using wordpress for a four-page website may be an overkill?
- Searching Only Blog Posts From a WordPress Site’s Main Posts Page?
- WordPress product catalog site [closed]
- What are the advantages of WordPress over other systems?
- Putting main WordPress blog under a different folder name
- Is a complex site possible with WordPress?
- Convert link in WordPress 3.2.1
- WordPress for a business catalog site
- Allow users to post to a certain category
- Why are wordpress posts not hierarchical?
- WordPress as a CMS – best way to decouple publishing/front-end
- Updating my wordpress CMS to 4.7 gives me a blank HTML area during the upgrade process
- How can I copy all users to newly created site on a multisite network in WordPress?
- Content management for static pages
- WordPress in Drupal
- Why does blog page not reveal it’s template?
- Is wordpress truly capable of anything other than blogging? [closed]
- About WordPress capabilities [closed]
- Is wordpress a library with a default GUI?
- Editing Code for CMS *** Fixed – my own stupidity – I appologise and thank everyone for their help [closed]
- Show a different link based on IP
- Can I manage content of my custom site using wordpress?
- Get Drupal user into WordPress
- How do I add open graph tags? [closed]
- Can’t access Dashboard after WordPress 3.3 Update?
- Heterogeneous content on a page
- Import only new articles from Joomla to WordPress
- Migrate php folder to WordPress
- import (migration) user database to wp-users
- Multiple editable content on page
- Set a WordPress website’s language without affecting the back-end
- Can WordPress used as a CMS? [closed]
- Remove admin menu
- Associating two custom post types
- Limitations when adding new users
- How do I manage my users post before publish?
- Fetch all data of Users
- How to establish site-wide fields with my theme?
- How to make Users sort in reverse order by default?
- How do you manage your pages or functions that require logged-in users?
- How to get ID of Edit User page during wp_handle_upload_prefilter, whilst in Media picker?
- Querying specific table row by current user login
- Custom Field Repeating When Using foreach
- Can I use paginate_links() to add a pagination list, yet prevent it from inserting links?
- How to Show Different Menus to Logged in Users in WordPress [duplicate]
- Combining user database tables while keeping all other data in seperate for multiple sites?
- How to make current user’s avatar + display name link to their profile?
- How to pass a query string to another page on the same site?
- Import users once a day without a plugin
- Custom capability for a single user
- get random users each time based on the meta key
- Save custom field types with this function…?
- Allow Weak Passwords
- How do I modify the user role ‘subscriber’ to allow the user to delete posts
- Disable Author Archive just for certain roles in bulk
- delete_user_meta from a foreach results page
- Is it possible with a code snippet to display a green dot on top of every avatar on a WordPress site for each user that is online?
- How to display all user profile info in myaccount page wordpress
- Query posts by post type, author and post meta
- Allowing duplicating users with same user_login and user_email
- How to display total user count by specific role in WordPress as statistics?
- Get wordpress post with featured image, category and tag from WordPress API
- After importing items are not displaying
- Get user in rest API endpoint
- wordpress Account Management generate password missing on my laptop
- Safely changing UserID’s, re-using deleted UserID’s and automatically using deleted userID’s instead of an increment
- Allow specific user to edit a specific page
- How to make custom user profile page public?
- Disable emails for new user registration
- Query for post term that matches user ID
- is_user_logged_in() not working in homepage
- Logging search queries for logged-in users
- Importing Posts into New Website with Same User ID’s
- How can I save cookies to members
- Change user URL
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- List users of specific role instead of removing them with specific role
- Resend user activation mail
- Defined user role to access plugin’s pages
- Cloning admin pages like users.php
- How can I bulk import into galleries?
- Changing user_login ends current session
- How to set different users for different pages?
- Import Excel (or csv) Table with user-data as subscribers to wordpress
- Using and saving custom dropdown boxes on user profiles
- How to create front-end (editable) WordPress user profile pages?
- Cross origin ajax request always returns 0 when calling get_current_user_id();
- Securely log in a user without a password using a link?
- One folder to be accessible by one user
- Use WordPress to create a custom CMS? [closed]
- User submitted post
- How to track all users logged into a site?
- Export user data from Squirrly’s Starbox plugin?
- Redirect WordPress page to the latest created post by the logged in author/user