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]
- change Dashboard default page on login
- If the current user is an administrator or editor
- Tips for using WordPress as a CMS? [closed]
- How to check if a user is in a specific role?
- How to change the default registration email ? (plugin and/or non-plugin)
- Getting a List of Currently Available Roles on a WordPress Site?
- Editor can create any new user except administrator
- How do I add a field on the Users profile? For example, country, age etc
- How To Add Custom Form Fields To The User Profile Page?
- Multiple developers / editors working on a site in progress
- How to check if a user (not current user) is logged in?
- Implementing a CrunchBase.com Clone using WordPress?
- How to restrict dashboard access to Admins only?
- How do I display logged-in username IF logged-in?
- Admin Page Redirect
- How to allow an user role to create a new user under a role which lower than his level only?
- Style custom columns in admin panels (especially to adjust column cell widths)
- user_login vs. user_nicename
- How to programatically change username (user_login)?
- Allowing user to edit only certain pages
- Why are my roles not visible in a Multi-site/Network?
- Custom post type for ‘staff’ versus using wordpress user profiles?
- Change the Author Slug from Username to Nickname
- How to search for (partial match) display names of WordPress users?
- Remove Ability for Other Users to View Administrator in User List?
- Is there anything that Joomla or Drupal can do that can’t be done in WordPress? [closed]
- How to use same email for multiple users
- Adding fields to the “Add New User” screen in the dashboard
- How to search all user meta from users.php in the admin
- How to check if a user exists by a given id
- Difference between update_user_meta and update_user_option
- Where can I find documentation on what characters are allowed in user names and why?
- Make display name unique
- Make WooCommerce pages accessible for logged in users only
- Find out if logged in user is not subscriber
- WordPress usermeta scaling for thousands of users
- How many users can WordPress handle?
- How do I programmatically set default role for new users?
- How to get WordPress Username in Array format
- How to filter users on admin users page by custom meta field?
- Display user registration date
- Is there a is_user_logged_in() for multisite?
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Override WordPress user with Oauth2 account
- Get multiple roles with get_users
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- get_user_meta() doesn’t include user email?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Update post counts (published, draft, unattached) in admin interface
- Confirmation required on email change
- How to Merge Two Authors Into One?
- How can I bulk upload images and automatically create posts for each one at the same time?
- Whats the best way to share user data across multiple WordPress websites?
- Cleanup uploads folder, Media Library db structure
- get_current_user_id() returns 0?
- How to prevent a post from being deleted?
- Is there a way (plugin?) to restrict a user to being able to edit just one page?
- How to bulk delete all users with no posts?
- Commenting in user profile page?
- How to get userid at wp_logout action hook?
- Groups of capabilities: users with multiple roles?
- Is there a way to merge two users?