Skip to content

Instantly share code, notes, and snippets.

@wadadanet wadadanet/cpt_news.php
Last active Nov 15, 2019

Embed
What would you like to do?
Wordpress CPT 新着情報
function cptui_register_my_cpts_news() {
/**
* Post Type: 新着情報.
*/
$labels = [
"name" => __( "新着情報", "twentytwenty" ),
"singular_name" => __( "新着情報", "twentytwenty" ),
];
$args = [
"label" => __( "新着情報", "twentytwenty" ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"delete_with_user" => false,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"delete_with_user" => false,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => [ "slug" => "news", "with_front" => true ],
"query_var" => true,
"menu_icon" => "dashicons-megaphone",
"supports" => [ "title", "editor" ],
];
register_post_type( "news", $args );
}
add_action( 'init', 'cptui_register_my_cpts_news' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.