如何解决为什么自定义帖子类型存档和单页显示 404 错误
我创建了一个名为 Portfolio 的自定义帖子类型。创建帖子类型后,我更新了永久链接。但是当我转到自定义帖子类型存档页面或单个页面时,它会显示 404 错误。
这是存档页面: https://dc1.justcreative.com/portfolio-item/
这是单页: https://dc1.justcreative.com/portfolio-item/primitive/
function jc_portfolio_post_type() {
$labels = array(
'name' => _x( 'Portfolio','Post Type General Name','jc' ),'singular_name' => _x( 'Portfolio','Post Type Singular Name','menu_name' => __( 'Portfolio','name_admin_bar' => __( 'Portfolio','archives' => __( 'Item Archives','attributes' => __( 'Item Attributes','parent_item_colon' => __( 'Parent Item:','all_items' => __( 'All Items','add_new_item' => __( 'Add New Item','add_new' => __( 'Add New','new_item' => __( 'New Item','edit_item' => __( 'Edit Item','update_item' => __( 'Update Item','view_item' => __( 'View Item','view_items' => __( 'View Items','search_items' => __( 'Search Item','not_found' => __( 'Not found','not_found_in_trash' => __( 'Not found in Trash','featured_image' => __( 'Featured Image','set_featured_image' => __( 'Set featured image','remove_featured_image' => __( 'Remove featured image','use_featured_image' => __( 'Use as featured image','insert_into_item' => __( 'Insert into item','uploaded_to_this_item' => __( 'Uploaded to this item','items_list' => __( 'Items list','items_list_navigation' => __( 'Items list navigation','filter_items_list' => __( 'Filter items list',);
$rewrite = array(
'slug' => 'portfolio-item','with_front' => true,'pages' => true,'Feeds' => true,);
$args = array(
'label' => __( 'Portfolio','description' => __( 'Post Type Description','labels' => $labels,'supports' => array( 'title','editor','thumbnail','revisions' ),'taxonomies' => array( 'portfolio_filter' ),'hierarchical' => false,'public' => true,'show_ui' => true,'show_in_menu' => true,'menu_position' => 5,'show_in_admin_bar' => true,'show_in_nav_menus' => true,'can_export' => true,'has_archive' => true,'exclude_from_search' => false,'publicly_queryable' => true,'rewrite' => $rewrite,'capability_type' => 'page',);
register_post_type( 'portfolio',$args );
}
add_action( 'init','jc_portfolio_post_type',0 );
有人告诉我如何解决这个问题?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。