register_post_type example


/** * Creates the initial post types when 'init' action is fired. * * See {@see 'init'}. * * @since 2.9.0 */
function create_initial_post_types() {
    WP_Post_Type::reset_default_labels();

    register_post_type(
        'post',
        array(
            'labels'                => array(
                'name_admin_bar' => _x( 'Post', 'add new from admin bar' ),
            ),
            'public'                => true,
            '_builtin'              => true, /* internal use only. don't use this when registering your own post type. */
            '_edit_link'            => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
            'capability_type'       => 'post',
            'map_meta_cap'          => true,
            'menu_position'         => 5,
            
Home | Imprint | This part of the site doesn't use cookies.