-
-
Save anonymous/48d9ef8953aeb62a4942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$post = array( | |
'ID' => null, //Are you updating an existing post? | |
'menu_order' => 0, //If new post is a page, it sets the order in which it should appear in the tabs. | |
'comment_status' => 'open', // 'closed' means no comments. | |
'ping_status' => 'open', // 'closed' means pingbacks or trackbacks turned off | |
'pinged' => null, //? | |
'post_author' => 433, //The user ID number of the author. | |
'post_category' => array(52), //post_category no longer exists, try wp_set_post_terms() for setting a post's categories | |
'post_content' => "", //The full text of the post. | |
'post_date' => date("Y-m-d H:i:s"), //The time post was made. | |
'post_date_gmt' => date("Y-m-d H:i:s"), //The time post was made, in GMT. | |
'post_excerpt' => null, //For all your post excerpt needs. | |
'post_name' => $post['submission_id'], // The name (slug) for your post | |
'post_parent' => 0, //Sets the parent of the new post. | |
'post_password' => '', //password for post? | |
'post_status' => 'pending', //Set the status of the new post. | |
'post_title' => $post['submission_id'], //The title of your post. | |
'post_type' => 'post', //You may want to insert a regular post, page, link, a menu item or some custom post type | |
'tags_input' => null, //For tags. | |
'to_ping' => null, //? | |
'tax_input' => array( 'category' => 52 ) | |
); | |
$post_id = wp_insert_post( $post, true ); | |
if (is_wp_error($id)) { | |
$errors = $id->get_error_messages(); | |
print "<pre>"; print_r($errors); print "</pre>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment