wp_insert_post() or similar for custom post type

From the Codex:

wp_insert_post() will fill out a default list of these but the
user is required to provide the title and content otherwise the
database write will fail.

$id = wp_insert_post(array(
  'post_title'=>'random', 
  'post_type'=>'custom_post', 
  'post_content'=>'demo text'
));

Leave a Comment

error code: 523