Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change WP admin post status filter for custom post type

How do you change/rename the text of post statuses in the top of the WP custom post type page

All | Published | Scheduled | Draft

like image 213
rickyit Avatar asked Apr 03 '13 22:04

rickyit


1 Answers

Using the filter views_edit-{$post_type}. Modify the array to set the desired post types:

foreach( array( 'post', 'portfolio' ) as $hook )
    add_filter( "views_edit-$hook", 'modified_views_so_15799171' );

function modified_views_so_15799171( $views ) 
{
    $views['all'] = str_replace( 'All ', 'Tutti ', $views['all'] );

    if( isset( $views['publish'] ) )
        $views['publish'] = str_replace( 'Published ', 'Online ', $views['publish'] );

    if( isset( $views['future'] ) )
        $views['future'] = str_replace( 'Scheduled ', 'Future ', $views['future'] );

    if( isset( $views['draft'] ) )
        $views['draft'] = str_replace( 'Drafts ', 'In progress ', $views['draft'] );

    if( isset( $views['trash'] ) )
        $views['trash'] = str_replace( 'Trash ', 'Dustbin ', $views['trash'] );

    return $views;
}

preview

like image 78
brasofilo Avatar answered Sep 22 '22 09:09

brasofilo