WordPress: insert a user into the database

WordPress stores all user data in two tables, namely wp_users and wp_user_meta. If you've ever tried to insert a new user in the database, you've surely stumbled on some WordPress error while trying to display user preferences or profiles. The point is that both tables work together, so that if you fail to specify some data in one of these tables, you'll get an error. Fortunately, there's a solution.