6) Insert Post

BTW: In the array being passed to wp_insert_post above, realize that the post_type element doesn’t have to be a page, it could be a simple post or any of several other types. Same thing with the post_status element which could be draft, or pending, etc. Look in the documentation and you will see the many options for post_type and post_status. The following is pseudo code. It is formatted this way as documentation in the WordPress codex:

insert post