I've made custom post type without title and editor and I use custom taxonomies, custom fields and attachments to form a post. My title is generated from custom taxonomies and custom fields (or "ID #" if nothing else is set). Here's title code (could use some polishing probably):

function custom_post_type_title ( $post_id ) {
    global $wpdb;
    if ( get_post_type( $post_id ) == 'cars' ) {
        $autos = wp_get_object_terms($post_id, 'brand');
            $brand= '';
            $model= '';
                foreach ( $autos as $auto ) {
                    if ( $auto->parent == 0) {
                        $brand = ' '.$auto->name;
                    } else {
                        $model .= ' '.$auto->name;
        $engine = get_post_meta($post_id, 'Engine', true);
        if ($engine != '') { $engine = ', '.$engine.'l'; }
        $title = $brand.$model.$engine;
        if ($title == '') { $title = 'ID '.$post_id; }
        $slug = sanitize_title('id-'.$post_id.$brand.$model.$engine);
        $where = array( 'ID' => $post_id );
        $wpdb->update( $wpdb->posts, array( 'post_title' => $title, 'post_name' => $slug), $where );

add_action('init', 'cars_save_post');
function cars_save_post($post_id) {
        if ( ! defined( 'DOING_AUTOSAVE' ) && ! DOING_AUTOSAVE ) return;
        add_action('save_post', 'custom_post_type_title', 100);
        add_action('publish_post', 'custom_post_type_title', 100);

Problem is, if I attach an image and navigate away from the post, post will be saved, but won't apear as draft in my post list. The only way (that I know of) I can reach it - thru media's "attached to" link.

Not sure if it's a bug or what, but I would like to see those posts in my Manage Posts list. Any solutions?


Maybe I wasn't clear enough. Just try this scenario:

  • Add New Post (regular post will do);
  • Upload an Image to it;
  • Keep everything else empty;
  • Do not save the post;
  • Leave the page;

Now if you'll check your Posts page, you won't find an "Auto Draft" in it. But if you'll check your Media page, image you uploaded just now, will be attached to "Auto Draft", which you can access from there. Even if you delete that image, that post will stay.

I just want to keep my server clean, so if Author made a mistake and forgot to save his post, he should have an easy access to that post via Posts Page.

So my question was, is this a bug and how can I fix it (display "Auto Drafts" in authors Posts page)?

  • How do you "set" your title? If you don't populate the field upon save, you propably can't see it. I guess you're adding the title only on output/template?
    – kaiser
    Jun 27, 2011 at 1:37
  • Title is fine, even that draft get's correct title (ID #). Updated my question with code. If it's done via regular posts, post is named "Auto Draft", but same issue remains.
    – Kovas
    Jun 27, 2011 at 8:00
  • Deactivate your plugins step by step and see if it remains. If it does, switch back to TwentTen. If this solves it, start takin one file out of your theme after the other until you found the cause. Then start writing return after the first code block until you find the one that makes your problems.
    – kaiser
    Jun 27, 2011 at 9:59
  • I think it's default WordPress behavior. I deactivated all plugins and switched to 2010 and nothing changed. Posts with attachments but without title or content are not displayed in post list, but are saved under "Auto Draft" name (can be seen in Media's "Attached to" column).
    – Kovas
    Jun 27, 2011 at 10:21
  • I remember that I had the problem myself and stopped trying to get around it. You have to auto-populate your title upon save as i said in the first comment.
    – kaiser
    Jun 27, 2011 at 10:24

1 Answer 1


You probably need to modify the columns displayed in your Custom Post posts list, so that the list isn't dependent solely on Post Title.

I have a similar situation, with a Custom Post Type that consists solely of a "featured image" (and a "link" custom metabox). I modified the Post list to output the image, which linked to the edit-post page.

You may need to do something similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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