Been using this answer -->> (link) 在我的类别中创建一些自定义字段,效果很好!我唯一的问题是,我有一个前端表单,允许用一个不相关的表单创建新类别,我想为我的自定义字段以及每个类别预定义字段插入值
我目前正在添加内置字段aka category name,slug&;说明
使用wp\\u insert\\u term使用此小支票(&B);插入脚本
if($_SERVER[\'REQUEST_METHOD\'] == "POST") {
$clientName = $_POST["clientName"];
$term_id = $_POST["clientName"];
$clientKeywords = $_POST["clientKeywords"];
$clientSlug = $_POST["clientSlug"];
$parent = \'\';
$errorType = \'Category "\'. $clientName .\'" Added!\';
wp_insert_term($clientName, \'category\', array(
\'description\'=>$clientKeywords,
\'slug\'=>sanitize_title($clientSlug),
\'parent\'=>$parent
));
}
Again.. inserting the custom fields values from the backend using the code i have found in the answer i have linked from at the beginning of my question works very well but i have tried a lot of ways to make it work from the front-end / integrate it with wp_insert_term and have not succeeded so far.
任何帮助都将不胜感激