Wordpress - How to filter by post-format in admin?

Try this plugin i cooked up:

<?php
! defined( 'ABSPATH' ) AND exit;
/**
 * Plugin Name: (#26032) WP_List_Table Post Format filter extension
 * Plugin URI:  http://wordpress.stackexchange.com/questions/26032/how-to-filter-by-post-format-in-admin
 * Description: Filters the admin WP_List_Table by post format
 * Author:      Bainternet
 * Author URI: http://en.bainternet.info
 */


function wpse26032_admin_posts_filter( &$query )
{
    if ( 
        is_admin() 
        AND 'edit.php' === $GLOBALS['pagenow']
        AND isset( $_GET['p_format'] )
        AND '-1' != $_GET['p_format']
        )
    {
        $query->query_vars['tax_query'] = array( array(
             'taxonomy' => 'post_format'
            ,'field'    => 'ID'
            ,'terms'    => array( $_GET['p_format'] )
        ) );
    }
}
add_filter( 'parse_query', 'wpse26032_admin_posts_filter' );

function wpse26032_restrict_manage_posts_format()
{
    wp_dropdown_categories( array(
         'taxonomy'         => 'post_format'
        ,'hide_empty'       => 0
        ,'name'             => 'p_format'
        ,'show_option_none' => 'Select Post Format'
    ) );
}
add_action( 'restrict_manage_posts', 'wpse26032_restrict_manage_posts_format' );

I was actually already working on a solution for you, just had to rewrite several parts of the code(because i based it off another plugin i wrote that does the same but for page templates on hierarchal types).

This is a little bigger than Bainternet's plugin, so by all means stick to his solution if you're happy with it(don't feel obligated to switch is all i'm saying), i'm going to post it up anyway, for the sake of anyone who may be interested. It'll work for any post type that supports post formats.

Edit/Update: Decided i might aswell put the code into a proper plugin, also did the same for adding a page template filter to hierarchal post types(that support page templates). Linked below for anyone interested,

  • Post Format Filter
  • Page Template Filter

Hope that's helpful.. :)