我有一个CPT公文包和一个默认的permastructure/blog/%postname%/
当我添加blogpost www.domain时。com/blog/blogname
当我添加网页www.domain时。com/pagename
But 当我添加投资组合时,permalink是:
www.domain。com/blog/portfolioname/portfolioname
I want:www.domain。com/portfolioname/portfolioname
我如何才能做到这一点?
function cpt_portfolios() {
$labels = array(
\'name\' => _x( \'Portfolio\\\'s\', \'Post Type General Name\', \'Portfolio\' ),
\'singular_name\' => _x( \'Portfolio\', \'Post Type Singular Name\', \'Portfolio\' ),
\'menu_name\' => __( \'Portfolio\\\'s\', \'Portfolio\' ),
\'name_admin_bar\' => __( \'Portfolio\\\'s\', \'Portfolio\' ),
\'archives\' => __( \'Item Archives\', \'Portfolio\' ),
\'parent_item_colon\' => __( \'Parent Item:\', \'Portfolio\' ),
\'all_items\' => __( \'All Items\', \'Portfolio\' ),
\'add_new_item\' => __( \'Add New Item\', \'Portfolio\' ),
\'add_new\' => __( \'Add New\', \'Portfolio\' ),
\'new_item\' => __( \'New Item\', \'Portfolio\' ),
\'edit_item\' => __( \'Edit Item\', \'Portfolio\' ),
\'update_item\' => __( \'Update Item\', \'Portfolio\' ),
\'view_item\' => __( \'View Item\', \'Portfolio\' ),
\'search_items\' => __( \'Search Item\', \'Portfolio\' ),
\'not_found\' => __( \'Not found\', \'Portfolio\' ),
\'not_found_in_trash\' => __( \'Not found in Trash\', \'Portfolio\' ),
\'featured_image\' => __( \'Featured Image\', \'Portfolio\' ),
\'set_featured_image\' => __( \'Set featured image\', \'Portfolio\' ),
\'remove_featured_image\' => __( \'Remove featured image\', \'Portfolio\' ),
\'use_featured_image\' => __( \'Use as featured image\', \'Portfolio\' ),
\'insert_into_item\' => __( \'Insert into item\', \'Portfolio\' ),
\'uploaded_to_this_item\' => __( \'Uploaded to this item\', \'Portfolio\' ),
\'items_list\' => __( \'Items list\', \'Portfolio\' ),
\'items_list_navigation\' => __( \'Items list navigation\', \'Portfolio\' ),
\'filter_items_list\' => __( \'Filter items list\', \'Portfolio\' ),
);
$args = array(
\'label\' => __( \'Portfolio\', \'Portfolio\' ),
\'description\' => __( \'Portfolio\\\'s CPT\', \'Portfolio\' ),
\'labels\' => $labels,
\'supports\' => array( \'title\' ),
\'taxonomies\' => array(),
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 5,
\'menu_icon\' => \'dashicons-welcome-add-page\',
\'show_in_admin_bar\' => true,
\'show_in_nav_menus\' => true,
\'can_export\' => true,
\'has_archive\' => true,
\'exclude_from_search\' => false,
\'publicly_queryable\' => true,
\'capability_type\' => \'page\',
);
register_post_type( \'portfolio\', $args );
}
add_action( \'init\', \'cpt_portfolios\', 0 );