Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $new_post = array(
- 'post_title' => $title,
- 'post_content' => $story,
- 'post_category' => array('12'), // Usable for custom taxonomies too
- 'tags_input' => array($tags),
- 'post_status' => 'submission-received', // Choose: publish, preview, future, draft, etc.
- 'post_type' => 'post' //'post',page' or use a custom post type if you want to
- );
- //save the new post
- $pid = wp_insert_post($new_post);
- /* Insert Form data into Custom Fields */
- add_post_meta($pid, 'form-name', $name, true);
- add_post_meta($pid, 'form-email', $email, true);
- add_post_meta($pid, 'form-city', $city, true);
- add_post_meta($pid, 'form-state', $state, true);
- add_post_meta($pid, 'form-agree', $agree, true);
- print '<pre>';
- var_dump(array($new_post, $pid));
- print '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement