0
X
Add Snippet To Project
New Project
Add To Existing Project
/**
* Registers a custom post type 'my_post_type'.
*
* @since 1.0.0
*
* @return void
*/
function acts_post_type() : void {
$labels = [
'name' => _x( 'My Post Types', 'Post Type General Name', 'acts_post_type' ),
'singular_name' => _x( 'My Post Type', 'Post Type Singular Name', 'acts_post_type' ),
'menu_name' => __( 'My Post Types', 'acts_post_type' ),
'name_admin_bar' => __( 'My Post Types', 'acts_post_type' ),
'archives' => __( 'My Post Types Archives', 'acts_post_type' ),
'attributes' => __( 'My Post Types Attributes', 'acts_post_type' ),
'parent_item_colon' => __( 'Parent My Post Type:', 'acts_post_type' ),
'all_items' => __( 'All My Post Types', 'acts_post_type' ),
'add_new_item' => __( 'Add New My Post Type', 'acts_post_type' ),
'add_new' => __( 'Add A-CTS™', 'acts_post_type' ),
'new_item' => __( 'New My Post Type', 'acts_post_type' ),
'edit_item' => __( 'Edit My Post Type', 'acts_post_type' ),
'update_item' => __( 'Update My Post Type', 'acts_post_type' ),
'view_item' => __( 'View My Post Type', 'acts_post_type' ),
'view_items' => __( 'View My Post Types', 'acts_post_type' ),
'search_items' => __( 'Search My Post Types', 'acts_post_type' ),
'not_found' => __( 'My Post Type Not Found', 'acts_post_type' ),
'not_found_in_trash' => __( 'My Post Type Not Found in Trash', 'acts_post_type' ),
'featured_image' => __( 'Featured Image', 'acts_post_type' ),
'set_featured_image' => __( 'Set Featured Image', 'acts_post_type' ),
'remove_featured_image' => __( 'Remove Featured Image', 'acts_post_type' ),
'use_featured_image' => __( 'Use as Featured Image', 'acts_post_type' ),
'insert_into_item' => __( 'Insert into My Post Type', 'acts_post_type' ),
'uploaded_to_this_item' => __( 'Uploaded to this My Post Type', 'acts_post_type' ),
'items_list' => __( 'My Post Types List', 'acts_post_type' ),
'items_list_navigation' => __( 'My Post Types List Navigation', 'acts_post_type' ),
'filter_items_list' => __( 'Filter My Post Types List', 'acts_post_type' ),
];
$labels = apply_filters( 'my_post_type-labels', $labels );
$args = [
'label' => __( 'My Post Type', 'acts_post_type' ),
'description' => __( 'My Post Type Description', 'acts_post_type' ),
'labels' => $labels,
'supports' => [
'title',
'editor',
'excerpt',
'author',
'thumbnail',
'comments',
'trackbacks',
'revisions',
'custom-fields',
'page-attributes',
],
'taxonomies' => [
'A-CTS™',
'Adult-Content Themed Series™',
],
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-post',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'query_var' => 'A-CTS',
'exclude_from_search' => false,
'has_archive' => 'a-cts-archive',
'can_export' => true,
'capabilities' => [
'read_post' => 'read_acts',
'read_private_posts' => 'read_private_acts',
'edit_post' => 'edit_acts',
'edit_posts' => 'edit_acts',
'publish_posts' => 'publish_acts',
'delete_post' => 'delete_acts',
'edit_others_posts' => 'edit_others_acts',
],
'show_in_rest' => true,
];
$args = apply_filters( 'my_post_type-args', $args );
register_post_type( 'my_post_type', $args );
}
add_action( 'init', 'acts_post_type', 0 );
Post Type for a new type of Media, the A-CTS™