Changing labels of status filters for post grid

Is there a way to change filter labels for custom post type? For example, change Drafts (2) to Disabled (2) without localization plugins like Loco Translate?

I've tried apply_filters( views_{$this-screen-id}, $views ); filter, but array already contains links with html. Regex doesn't looks the right way.

Array
(
    [all] = a href=edit.php?post_type=sha-wlc class=current aria-current=pageAll span class=count(13)/span/a
    [publish] = a href=edit.php?post_status=publish#038;post_type=sha-wlcPublished span class=count(11)/span/a
    [draft] = a href=edit.php?post_status=draft#038;post_type=sha-wlcDrafts span class=count(2)/span/a
    [trash] = a href=edit.php?post_status=trash#038;post_type=sha-wlcTrash span class=count(1)/span/a
)

Topic plugin-development plugins Wordpress

Category Web


Here's an untested way to override it, based on my older answer:

add_action( 'init', function() {   
    $vars = get_object_vars( 
        get_post_status_object( 'draft' ) 
    );
    $vars['label_count'] = _n_noop(
        'Disabled <span class="count">(%s)</span>',
        'Disabled <span class="count">(%s)</span>',
        'wpse-domain'
    );
    register_post_status( 'draft', $vars );
}, 1 );

We use the priority 1, since the default draft status is registered at priority 0. You might look into the $vars['label'] as well.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.