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 noticed that when starting to create a new post, and only attach images and then when leavning the post for some reason, it won't show up in the list post view. However when you look in the Media Library you'll see that the image is attached to "Auto Draft" and that the post really exists.

Now, I find this useful, and would like to be able to list these Auto Drafts in the post view, but I don't really know what I need to do to list them.. Ideas?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

try pasting this in your theme's functions.php file

add_filter( 'parse_query', 'display_autosave_and_revisions' );
function display_autosave_and_revisions( $query )
{
    global $pagenow,$typenow;
    if ( is_admin() && $pagenow == 'edit.php' && $typenow == "post") {
        $query->query_vars['post_type'] = array('revision','post');
        $query->query_vars['post_status'] = 'any';
    }
}
share|improve this answer
    
Hm, nope, not showing up, are you sure that the ones I'm seeing in Media Library is auto saves or revisions? –  INT Jul 15 '11 at 16:40
    
No I'm not sure what you are seeing. But i am sure that auto-saves are revisions and I'm sure this code shows the revisions in the post listing –  Bainternet Jul 15 '11 at 18:59
    
The thing is, I've disabled auto save, but I still get auto drafts when attaching images (I guess it's a media attachment thing). –  INT Jul 15 '11 at 19:26
    
When you upload an image the built-in uploader must have a post type ao if you haven't saved the post yet , WordPress creates an auto save. –  Bainternet Jul 15 '11 at 19:31
    
Correction an auto-save is a post_type=revision and post_status=auto-save so i updated the code try now. –  Bainternet Jul 15 '11 at 19:39
show 3 more comments

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.