我想在提交表单时创建一个自定义帖子,并将表单数据插入到该自定义帖子中。
当我搜索时,我发现了一个使用“重力表单和重力表单+自定义帖子类型”的建议。但我需要自己的解决方案。
这是我的代码:
$title= $_POST[\'your_name\'];
 $decription=$_POST[\'e_mail\'];
$my_post = array(
  \'post_title\'    => wp_strip_all_tags( $title ),
  \'post_content\'  => $decription,
  \'post_status\'   => \'publish\',
  \'post type\'     => \'EmpResume\'
  //\'post_author\'   => 1,
  //\'post_category\' => array( 8,39 )
);
// Insert the post into the database
wp_insert_post( $my_post );
 但它将我的表单数据存储在“wp\\u posts”表中,而不是存储在我的自定义post中。