SHARE
TWEET

Untitled

a guest Jun 18th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // insert the post and set the category
  2. $post_id = wp_insert_post(array (
  3.     'post_type' => 'your_post_type',
  4.     'post_title' => $your_title,
  5.     'post_content' => $your_content,
  6.     'post_status' => 'publish',
  7.     'comment_status' => 'closed',   // if you prefer
  8.     'ping_status' => 'closed',      // if you prefer
  9. ));
  10.  
  11. if ($post_id) {
  12.     // insert post meta
  13.     add_post_meta($post_id, '_your_custom_1', $custom1);
  14.     add_post_meta($post_id, '_your_custom_2', $custom2);
  15.     add_post_meta($post_id, '_your_custom_3', $custom3);
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top