All the existing tables contain a pre-built insert functions for creating new records. Some of these functions uses a predefined set of parameters while other functions accepts array of information for inserting the record. Let's take a look at some of the frequently used insert functions:
wp_insert_post | Creates a new post or page in the wp_posts table. If this is used on an existing post, it will update the existing record. Accepts an array type parameter with all post details. |
add_option | Creates a new option in the wp_options table, if it doesn’t already exist. Accepts key and value as parameters. |
wp_insert_user | Creates a new user in the wp_users table. Accepts an array type parameter with all post details. |