【发布时间】:2011-03-01 21:47:20
【问题描述】:
我的目标只是使用某种类型的默认方法来检查 Wordpress 中是否存在类别,如果不存在,则添加该类别。与标签相同。
这是我试图让它发生的一团糟:
<?php
if (is_term('football', 'category')) {
}
else (
$new_cat = array('cat_name' => 'Football', 'category_description' => 'Football Blogs', 'category_nicename' => 'category-slug', 'category_parent' => 'sports');
$my_cat_id = wp_insert_category($new_cat);
)
我打算将其添加为插件。任何想法或帮助都会很棒!
【问题讨论】:
-
抱歉,没有为语句输入代码:
标签: wordpress