0

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?

1

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';
    }
}
  • 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

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.