Skip to content

Instantly share code, notes, and snippets.

@wadadanet
Last active November 15, 2019 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wadadanet/a18a225bf3e7a8a43f21f04aa0590720 to your computer and use it in GitHub Desktop.
Save wadadanet/a18a225bf3e7a8a43f21f04aa0590720 to your computer and use it in GitHub Desktop.
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