使用分配了自定义功能的WordPress自定义帖子类型遇到一个非常奇怪的事情:

分配自定义功能后,永久链接“链接”(显示在WordPress编辑屏幕 Headers 字段下方的链接)将停止链接到实际帖子,并开始链接到编辑屏幕 .

如果我删除自定义功能,它将恢复正常工作 . 我确信我只是错过了明显的,但不确定它可能是什么 .

CPT代码是这样的:

$labels = array(
    'name'                => _x( 'Plants', 'Post Type General Name', 'nsfs_non_fran' ),
    'singular_name'       => _x( 'Plants', 'Post Type Singular Name', 'nsfs_non_fran' ),
    'menu_name'           => __( 'Plants', 'nsfs_non_fran' ),
    'parent_item_colon'   => __( 'Parent Plants:', 'nsfs_non_fran' ),
    'all_items'           => __( 'All Plants', 'nsfs_non_fran' ),
    'view_item'           => __( 'View Plants', 'nsfs_non_fran' ),
    'add_new_item'        => __( 'Add New Plants', 'nsfs_non_fran' ),
    'add_new'             => __( 'Add New', 'nsfs_non_fran' ),
    'edit_item'           => __( 'Edit Plants', 'nsfs_non_fran' ),
    'update_item'         => __( 'Update Plants', 'nsfs_non_fran' ),
    'search_items'        => __( 'Search Plants', 'nsfs_non_fran' ),
    'not_found'           => __( 'Not found', 'nsfs_non_fran' ),
    'not_found_in_trash'  => __( 'Not found in Trash', 'nsfs_non_fran' ),
);

$capabilities = array(
    'edit_post'             => 'edit_plant',
    'read_post'             => 'read_plant',
    'delete_post'           => 'delete_plant',
    'edit_posts'            => 'edit_plant',
    'edit_others_posts'     => 'edit_others_plant',
    'publish_posts'         => 'publish_plant',
    'read_private_posts'    => 'read_private_plant',
);

$args = array(
    'label'               => __( 'Plants', 'nsfs_non_fran' ),
    'description'         => __( 'Plants', 'nsfs_non_fran' ),
    'labels'              => $labels,
    'supports'            => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),
    'taxonomies'          => array( 'post_tag', 'genus' ),
    'hierarchical'        => true,
    'public'              => true,
    'show_ui'             => true,
    'show_in_menu'        => true,
    'show_in_nav_menus'   => true,
    'show_in_admin_bar'   => true,
    'menu_position'       => 20,
    'menu_icon'           => 'dashicons-format-image',
    'can_export'          => true,
    'has_archive'         => true,
    'exclude_from_search' => false,
    'publicly_queryable'  => true,
    'capability_type'     => $capabilities,
    'rewrite'             => array( 'slug' => 'genera' ),
);
register_post_type( 'genera', $args );