wp_insert_post() or similar for custom post type - WordPress Development Stack Exchange

PHOTO EMBED

Sun Jun 04 2023 15:25:02 GMT+0000 (Coordinated Universal Time)

Saved by @leninzapata #php

$post_id = wp_insert_post(array (
   'post_type' => 'your_post_type',
   'post_title' => $your_title,
   'post_content' => $your_content,
   'post_status' => 'publish',
   'comment_status' => 'closed',
   'ping_status' => 'closed',
   'meta_input' => array(
      '_your_custom_1' => $custom_1,
      '_your_custom_2' => $custom_2,
      '_your_custom_3' => $custom_3,
    ),
));
content_copyCOPY

https://wordpress.stackexchange.com/questions/106973/wp-insert-post-or-similar-for-custom-post-type