【发布时间】:2014-08-21 11:11:07
【问题描述】:
我在我的网站上创建了一个名为 Homes 的自定义帖子类型,它可以正常工作。我创建了一个自定义分类法,命名为“可用性类别”,并在该类别中创建了一个名为“现在可用”的类别。分类显示在我的 Wordpress 后端,但是当我在 home/available-now 查看类别时,我收到 404 错误。
这是我的自定义帖子类型的代码:
register_post_type( 'Homes',
array(
'labels' => array(
'name' => __( 'Homes' ),
'singular_name' => __( 'Homes Item' ),
'add_new_item' => __('Add New Homes Item'),
'edit_item' => __('Edit Homes Item'),
'new_item' => __('New Homes Item'),
),
'supports' => array('title', 'thumbnail', 'editor'),
'taxonomies' => array('homes-category'),
'public' => true,
'has_archive' => false,
'show_in_nav_menus' => TRUE,
'show_in_menu' => TRUE,
'rewrite' => array(
'slug' => 'homes',
'with_front' => false,
'hierarchical' => false,
),
)
);
以及我的自定义分类的代码:
register_taxonomy(
'homes-category',
'homes',
array(
'hierarchical' => true,
'label' => __( 'Availability Category' ),
'rewrite' => array(
'slug' => 'homes',
'with_front' => false,
),
)
);
有人可以帮忙吗?我已经搜索了几个小时来解决问题,但到目前为止我所尝试的都没有奏效。任何帮助将不胜感激。
【问题讨论】:
标签: wordpress custom-post-type permalinks custom-taxonomy