Change WP admin post status filter for custom post type

萝らか妹 提交于 2019-12-22 08:20:02

问题


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

All | Published | Scheduled | Draft


回答1:


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



来源:https://stackoverflow.com/questions/15799171/change-wp-admin-post-status-filter-for-custom-post-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!