我正在尝试修改WordPress中的默认“post”,并将其更改为Projects。我不能让它工作。我不想创建新的CPT。我只想修改现有的功能。
这是我的代码:
function change_default_wp_post() {
$labels = array(
\'name\' => _x( \'Projects\', \'post type general name\', \'burst-portfolio\' ),
\'singular_name\' => _x( \'Project\', \'post type singular name\', \'burst-portfolio\' ),
\'menu_name\' => _x( \'Projects\', \'admin menu\', \'burst-portfolio\' ),
\'name_admin_bar\' => _x( \'Project\', \'add new on admin bar\', \'burst-portfolio\' ),
\'add_new\' => _x( \'Add New\', \'portfolio\', \'burst-portfolio\' ),
\'add_new_item\' => __( \'Add New Project\', \'burst-portfolio\' ),
\'new_item\' => __( \'New Project\', \'burst-portfolio\' ),
\'edit_item\' => __( \'Edit Project\', \'burst-portfolio\' ),
\'view_item\' => __( \'View Project\', \'burst-portfolio\' ),
\'all_items\' => __( \'All Projects\', \'burst-portfolio\' ),
\'search_items\' => __( \'Search Projects\', \'burst-portfolio\' ),
\'parent_item_colon\' => __( \'Parent Projects:\', \'burst-portfolio\' ),
\'not_found\' => __( \'No projects found.\', \'burst-portfolio\' ),
\'not_found_in_trash\' => __( \'No projects found in Trash.\', \'burst-portfolio\' ),
\'featured_image\' => __( \'Project Image\', \'burst-portfolio\' ),
\'set_featured_image\' => __( \'Set Project Image\', \'burst-portfolio\' ),
\'remove_featured_image\' => __( \'Remove Project Image\', \'burst-portfolio\' ),
\'use_featured_image\' => __( \'Use Project Image\', \'burst-portfolio\' ),
);
$args = array(
\'label\' => __( \'Portfolio\', \'burst-portfolio\' ),
\'labels\' => $labels,
\'menu_icon\' => \'dashicons-portfolio\',
\'public\' => true,
// \'supports\' => $features,
\'rewrite\' => array(
\'slug\' => __( \'portfolio\', \'burst-portfolio\' ),
),
);
register_post_type_args( $args, \'post\');
}
add_action( \'init\', \'change_default_wp_post\');