WordPress: wp_insert_post使用代码插入新的文章

$new_post = array(
  'post_content' => '这是新文章的内容',
  'post_title'   => '这是新文章的标题',
  'post_type'    => 'movie_bt',
  // 自定义分类法
  'tax_input'    => array(
    // 分类名称 => array(分类id, ...)
    'movie_bt_tags' => array(31),
    'movie_bt_cat'  => array(29, 30),
  ),
  // 自定义栏目
  'meta_input'   => array(
    'english_name_mi_value' => '这是英文名',
    'thumb_tes'             => '这是特色图片',
    'years_mi_value'        => 1996,
  ),
);
wp_insert_post($new_post);
评论
:broken_heart: :confounded: :flushed: :frowning: :grinning: :heart: :kissing_heart: :mask: :pensive: :rage: :relaxed: :scream: :smile: :smirk: :sob: :stuck_out_tongue_closed_eyes: :stuck_out_tongue_winking_eye: :wink: