How can i add custom_list as shown in attached screen-shot. I want to list posts having some meta_value . Is there any way of adding this. I am not looking to edit the core files. Please guide me in right way.

Add custom list menu on Posts page in admin panel


You can use the views_{$this->screen->id} filter in WP_List_Table::views(), where screen ID in this case is edit-post:

function wpse_177655_views( $views ) {
    $custom = sprintf( '<a href="%s"', esc_url( 'edit.php?post_type=post&custom=foobar' ) );
    if ( ! empty( $_GET['custom'] ) && $_GET['custom'] == 'foobar' )
        $custom .= ' class="current"';
    $custom .= '>Custom</a>';

    $views['custom'] = $custom;

    return $views;

add_filter( 'views_edit-post', 'wpse_177655_views' );

Obviously this is more of an example than an exact solution. You'll also need to hook onto pre_get_posts to add the relevant meta query args.

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.