[wp-trac] [WordPress Trac] #31500: New post type undefined delete post value
WordPress Trac
noreply at wordpress.org
Mon Mar 2 14:06:26 UTC 2015
#31500: New post type undefined delete post value
-------------------------------------------+-------------------------------
Reporter: ozzWANTED | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.2
Component: Posts, Post Types | Version: 4.1
Severity: normal | Resolution:
Keywords: reporter-feedback needs-patch | Focuses: ui,
| administration
-------------------------------------------+-------------------------------
Comment (by ozzWANTED):
Replying to [comment:1 DrewAPicture]:
> Hi ozzWANTED,
>
> Can you provide your post type registration code so we can attempt to
reproduce your issue?
Here you go my friend:
{{{
function crs_custom_post_type_init()
{
$menu_position1 = 95;
$icon_url = plugins_url().'/car-rental-system/images/plugin.ico';
// Set UI labels for Custom Post Type
$labels = array(
'name' => _x( 'Car Descriptions', 'Post
Type General Name', 'car-rental-system' ),
'singular_name' => _x( 'Car Description', 'Post Type
Singular Name', 'car-rental-system' ),
'menu_name' => __( 'Car Descriptions', 'car-
rental-system' ),
'parent_item_colon' => __( 'Parent Car', 'car-rental-
system' ),
'all_items' => __( 'All Car Descriptions', 'car-
rental-system' ),
'view_item' => __( 'View Car Description', 'car-
rental-system' ),
'add_new_item' => __( 'Add New Car Description',
'car-rental-system' ),
'add_new' => __( 'Add New Description', 'car-
rental-system' ),
'edit_item' => __( 'Edit Car Description', 'car-
rental-system' ),
'update_item' => __( 'Update Car Description',
'car-rental-system' ),
'search_items' => __( 'Search Car Description',
'car-rental-system' ),
'not_found' => __( 'Not Found', 'car-rental-
system' ),
'not_found_in_trash' => __( 'Not found in Trash', 'car-
rental-system' ),
);
// Set other options for Custom Post Type
$args = array(
'label' => __( 'cars', 'car-rental-system'
),
'description' => __( 'List of cars descriptions',
'car-rental-system' ),
'labels' => $labels,
// Features this CPT supports in Post Editor
'supports' => array( 'title', 'editor',
'author', 'thumbnail', ),
/* A hierarchical CPT is like Pages and can have
* Parent and child items. A non-hierarchical CPT
* is like Posts.
*/
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => $menu_position1,
'menu_icon' => $icon_url,
'can_export' => true,
'has_archive' => false,
'rewrite' => array(
// TRANSLATION IS A MUST
'slug' => 'automobiliai',
'with_front' => false,
'pages' => false,
),
'exclude_from_search' => false,
'publicly_queryable' => true,
/* To manage specific rights to edit only cars*/
'capability_type' => 'car',
);
// Registering your Custom Post Type
register_post_type( 'cars', $args );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31500#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list