我在我的网站上有一个名为“profiles”的类别,我正在将这个类别移动到一个名为“profiles”的自定义帖子类型。
我的问题是,我无法获取此自定义帖子类型的存档页面。当我转到url时mywebsite.com/profiles
它会将我带到一个单独的帖子页面,查看profiles类别中的帖子。
我已经包括has_archive = true;
在我的functions.php
我在同一个网站上为另一个自定义帖子类型创建归档页面时没有遇到任何问题,所以我真的不明白为什么这次不起作用。
如有任何建议,将不胜感激?
add_action( \'init\', \'profile_custom_init\' );
/* Here\'s how to create your customized labels */
function profile_custom_init() {
$labels = array(
\'name\' => _x( \'Profiles\', \'post type general name\' ), // Tip: _x(\'\') is used for localization
\'singular_name\' => _x( \'Profile\', \'post type singular name\' ),
\'add_new\' => _x( \'Add New\', \'Profile\' ),
\'add_new_item\' => __( \'Add Profile\' ),
\'edit_item\' => __( \'Edit Profile\' ),
\'new_item\' => __( \'New Profile\' ),
\'view_item\' => __( \'View Profile\' ),
\'search_items\' => __( \'Search Profile\' ),
\'not_found\' => __( \'No Profile found\' ),
\'not_found_in_trash\' => __( \'No Profile found in Trash\' ),
\'parent_item_colon\' => \'\'
);
// Create an array for the $args
$args = array( \'labels\' => $labels, /* NOTICE: the $labels variable is used here... */
\'public\' => true,
\'publicly_queryable\' => true,
\'has_archive\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'menu_position\' => 10,
\'supports\' => array( \'title\', \'editor\',\'thumbnail\', \'excerpt\', \'custom-fields\' ),
\'taxonomies\' => array(\'category\')
);
register_post_type( \'profile\', $args ); /* Register it and move on */
}