0
X
Add Snippet To Project
New Project
Add To Existing Project
/**
* Registers a custom post type 'plugin-data'.
*
* @since 1.0.0
*
* @return void
*/
function wpturbo_register_custom_plugin_data_post_type() : void {
$labels = [
'name' => _x( 'Plugin Data', 'Post Type General Name', 'wpturbo' ),
'singular_name' => _x( 'Plugin Data', 'Post Type Singular Name', 'wpturbo' ),
'menu_name' => __( 'Plugin Data', 'wpturbo' ),
'name_admin_bar' => __( 'Plugin Data', 'wpturbo' ),
'archives' => __( 'Plugin Data Archives', 'wpturbo' ),
'attributes' => __( 'Plugin Data Attributes', 'wpturbo' ),
'parent_item_colon' => __( 'Parent Plugin Data:', 'wpturbo' ),
'all_items' => __( 'All Plugin Data', 'wpturbo' ),
'add_new_item' => __( 'Add New Plugin Data', 'wpturbo' ),
'add_new' => __( 'Add New', 'wpturbo' ),
'new_item' => __( 'New Plugin Data', 'wpturbo' ),
'edit_item' => __( 'Edit Plugin Data', 'wpturbo' ),
'update_item' => __( 'Update Plugin Data', 'wpturbo' ),
'view_item' => __( 'View Plugin Data', 'wpturbo' ),
'view_items' => __( 'View Plugin Data', 'wpturbo' ),
'search_items' => __( 'Search Plugin Data', 'wpturbo' ),
'not_found' => __( 'Plugin Data Not Found', 'wpturbo' ),
'not_found_in_trash' => __( 'Plugin Data Not Found in Trash', 'wpturbo' ),
'featured_image' => __( 'Featured Image', 'wpturbo' ),
'set_featured_image' => __( 'Set Featured Image', 'wpturbo' ),
'remove_featured_image' => __( 'Remove Featured Image', 'wpturbo' ),
'use_featured_image' => __( 'Use as Featured Image', 'wpturbo' ),
'insert_into_item' => __( 'Insert into Plugin Data', 'wpturbo' ),
'uploaded_to_this_item' => __( 'Uploaded to this Plugin Data', 'wpturbo' ),
'items_list' => __( 'Plugin Data List', 'wpturbo' ),
'items_list_navigation' => __( 'Plugin Data List Navigation', 'wpturbo' ),
'filter_items_list' => __( 'Filter Plugin Data List', 'wpturbo' ),
];
$labels = apply_filters( 'plugin-data-labels', $labels );
$args = [
'label' => __( 'Plugin Data', 'wpturbo' ),
'description' => __( 'This custom plugin data won\'t be shown to public.', 'wpturbo' ),
'labels' => $labels,
'supports' => [
'custom-fields',
],
'hierarchical' => false,
'public' => false,
'show_ui' => false,
'show_in_menu' => false,
'menu_icon' => 'dashicons-admin-post',
'show_in_admin_bar' => false,
'show_in_nav_menus' => false,
'exclude_from_search' => true,
'has_archive' => false,
'can_export' => true,
'rewrite' => false,
'capability_type' => 'page',
'show_in_rest' => true,
'rest_base' => 'plugindata',
'rest_controller_class' => 'WP_REST_plugindata_Controller',
];
$args = apply_filters( 'plugin-data-args', $args );
register_post_type( 'plugin-data', $args );
}
add_action( 'init', 'wpturbo_register_custom_plugin_data_post_type', 0 );