我已经在下拉列表中显示了自定义分类法,正如您在红色框中看到的一样,我想问一下如何将它们与帖子一起提交。我想不出来`
// Do some minor form validation to make sure there is content
if (isset ($_POST[\'title\'])) {
$title = $_POST[\'title\'];
} else {
echo \'Please enter the wine name\';
}
// ADD THE FORM INPUT TO $new_post ARRAY
$new_post = array(
\'post_title\' => $title,
\'tax_input\' => array(
\'industries\' => $_REQUEST[\'taxonomy_id\'] ),
\'post_status\' => \'publish\', // Choose: publish, preview, future, draft, etc.
\'post_type\' => \'websites\' //\'post\',page\' or use a custom post type if you want to
);
//SAVE THE POST
$pid = wp_insert_post($new_post);
//SET OUR TAGS UP PROPERLY
//REDIRECT TO THE NEW POST ON SAVE
$link = get_permalink( $pid );
wp_redirect( $link );
} // END THE IF STATEMENT THAT STARTED THE WHOLE FORM
//POST THE POST YO
do_action(\'wp_insert_post\', \'wp_insert_post\');?>`
the form
enter code here