Clean up your WordPress Draft posts!

Where Ideas sometimes happen.

Categories: WordPress

I think I am what I would call an Idea guy. I like to come up with “cool” ideas, some times I will go as far as to write some specs, make some simple sketches… And then totally forget about them. Or if I am lucky I will come back to them months later. This was the case with my blog. I had around 70 draft posts and it reached the point where it was overwhelming.

I thought to myself, Self. If I had a simple way that I could organize the draft posts in some kind of favorited system, or even have an in-progress status.

So I did some searching and found that it was super simple to register a new post status!

function my_custom_post_status(){
    register_post_status( 'ideas', array(
        'label'                     => _x( 'Ideas', 'post' ),
        'public'                    => true,
        'exclude_from_search'       => false,
        'show_in_admin_all_list'    => true,
        'show_in_admin_status_list' => true,
        'label_count'               => _n_noop( 'Idea <span class="count">(%s)</span>', 'Ideas <span class="count">(%s)</span>' ),
    ) );
}
add_action( 'init', 'my_custom_post_status' );

Done! This was almost too simple.

I head back into the post editor and edit the status, only to see the same old statuses.

WTF!

Well after some database prodding I can manually set the status to Ideas but it won’t show in the WordPress meta box. LAME!

There is an outstanding issue for this in the WordPress track from years ago. Seems like it’s not a high priority.

As it is WordPress tradition to reinvent the wheel or simply install a plugin to add that %10 that WordPress won’t do for you I found a plugin called Custom Post Status and took a trip under Tools / Custom Status Settings Added Ideas, Hit save and presto!

Making it better

I can now add my “Ideas”, Next I wanted to include Drafts and IDeas in the WordPress sidebar.

add_action( 'admin_menu', 'add_custom_link_into_appearance_menu' );
function add_custom_link_into_appearance_menu() {
    global $submenu;
    $draftLink             = 'edit.php?post_status=draft&post_type=post';
    $ideaLink              = 'edit.php?post_status=ideas&post_type=post';
    $submenu['edit.php'][] = array( 'Drafts', 'manage_options', $draftLink );
    $submenu['edit.php'][] = array( 'Ideas', 'manage_options', $ideaLink );
}

My workflow now is to jot down quick ideas in a title, include any materials in the content editor and then mark them as an Idea. When I come back to finish them up ( If I finish them… ) I mark them as a draft.

Now I have my real Draft posts and my Ideas that can sit and grow. But it also greatly cleaned up the look of my site since as an Admin I allow the listing of Draft posts in my blog loop. It helps me visualize thumbnails, titles, and subheadings.

Read more on How to display draft posts in the blog loop.


Adam Patterson

Adam Patterson

User Interface Designer & Developer with a background in UX. I have spent 5 years as a professionally certified bicycle mechanic and ride year-round.

I am a husband and father of two, I enjoy photography, music, movies, coffee, and good food.

You can find me on Twitter, Instagram, and YouTube!