【发布时间】:2012-04-10 12:36:08
【问题描述】:
我在向我的自定义帖子添加自定义分类时遇到了一些问题。我已经创建了这样的自定义帖子:
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'profiel_pagina',
array(
'labels' => array(
'name' => __( 'Profiel pagina' ),
'singular_name' => __( 'Profiel pagina' )
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail')
)
);
还有像这样的自定义分类法:
function create_my_taxonomies() {
register_taxonomy('vakgebied', 'post', array(
'hierarchical' => false, 'label' => 'Vakgebied',
'query_var' => true, 'rewrite' => true));
}register_taxonomy('specialisatie', 'post', array(
'hierarchical' => false, 'label' => 'Specialisatie',
'query_var' => true, 'rewrite' => true));
}
add_action('init', 'create_my_taxonomies', 0);
这一切都很好,但我怎样才能将这两者联系起来呢?使用 'taxonomies' => array('post-tag') 不起作用。根据法典,在添加自定义分类时也使用“post”不是正确的方法,但我应该怎么做?
非常感谢任何帮助。
【问题讨论】:
标签: wordpress custom-post-type custom-taxonomy