REGISTER_TAYNOMY和REGISTER_POST_TYPE不起作用

时间:2011-05-16 作者:Marcomar

我在Wordpress上使用register\\u post\\u类型和register\\u分类法时遇到问题。我在函数上创建了代码。php,它不会更新我的面板。为什么?

//Categorias personalizadas
register_taxonomy(\'produtos\', \'produto\', array(\'hierarchical\' => true, \'label\' => \'Categorias de Produtos\', \'query_var\' => true, \'rewrite\' => true));
//Posts personalizados
add_action(\'init\', \'create_post_type\');
function create_post_type() {
    register_post_type(\'produto\',
    array(
        \'labels\' => array(
        \'name\' => __(\'Produto\'),
        \'singular_name\' => __(\'Produto\')),
        \'public\' => true,
        \'rewrite\' => true,
        \'supports\' => array(\'title\',\'editor\',\'author\',\'thumbnail\',\'excerpt\',\'comments\',\'custom-fields\',\'image\'),
        \'has_archive\' => true)
    );
}

1 个回复
最合适的回答,由SO网友:eeMZee 整理而成

我将您的代码复制粘贴到我的函数中。php和它对我有用,请确保您使用的是最新版本的WordPress,它支持自定义帖子类型

结束

相关推荐

Custom Post Row Actions

我偶然发现this question 在写这个问题的时候。我有一个问题是关于这个问题的。我发现你用的是get_delete_post_link 筛选为我的操作创建一个新的url(或一个类似的函数——在任何情况下,我都会将该函数与布尔值一起使用)。唯一的问题是,I don\'t know how to capture the event now. 考虑到我在谷歌上找不到很多关于行后操作的例子,我将不胜感激-/public function _wp_filter_get_delete_post_link( $