1

I missed the title on custom post types on new or edit page; I have added some custom fields, but Title disappeared.

register_post_type( 'videos', array(  
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'exclude_from_search' => true,
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'has_archive' => true,
    'hierarchical' => false,
    'menu_position' => 10,
    'supports' => array( 'editor' ),
    'register_meta_box_cb' => 'videos_meta_boxes',
) );

This is the first time I tried to add customs post types on my own. I think something here is missing.

5

By declaring a value for the parameter 'supports', you override the default output which shows the 'title' and 'editor'. http://codex.wordpress.org/Function_Reference/register_post_type

I recommend removing the 'supports' parameter if you don't need any other post fields (reduce clutter on the page) or just re-iterate the default (in case you want to easily add more fields like thumbnail or comments later):

'supports' => array( 'title', 'editor' )
  • @JMa :/ Now title not updating, just permalink and slug are taking the value from title field, but the title changes after saving or updating to custom post type name plus Post number, for example "video - 2040" "video - 2041" and so on. – Fernando Baltazar Jul 2 '13 at 22:50
  • Oh, I Find the error on Tuts Scripts, the failuring code is <code> wp_update_post( array( 'ID' => $post_id, 'post_title' => 'video - ' . $post_id ) ); </code><br> I change the line post_title and now I have a title updating <br> <code> wp_update_post( array( 'ID' => $post_id, 'post_title' => $_POST['post_title'] ) ); </code> – Fernando Baltazar Jul 2 '13 at 23:26
3

You missed this in your code :

'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.