Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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' )
share|improve this answer
1  
Thanks for recommendation! –  Fernando Baltazar Jul 2 '13 at 20:55
    
Thanks. I should have been more precise in my answer –  JMau Jul 2 '13 at 20:57
    
@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
add comment

You missed this in your code :

'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
share|improve this answer
    
Thanks! now all works pretty well... –  Fernando Baltazar Jul 2 '13 at 20:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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