How to change “Draft” string for status of custom post type to “Unavailable”?

ANSWER MOD: just an important mod to the chosen answer:

// check if you actually have drafts; also avoids extra '|' separator
if (isset($views['draft'])) {
    // 'Drafts' should be added (and come first) if you don't want to end up with 'Unavailables'
    $views['draft'] = str_replace(array('Drafts','Draft'), 'Unavailable', $views['draft']);
}

and the mentioned caveat is not showing up for me on 3.4. 😀

Read More

Only for one particular custom post type employee, I want to change the name/string “Draft” (which stands for the 'draft' status) to “Unavailable” for any employee post that has a 'draft' status, anywhere the name shows up on the admin screens and basically throughout the entire site, i.e.

enter image description here

Is there a hook for this? Or is there a better way to do this?

Related posts

Leave a Reply

1 comment

  1. I was investigating the issue for this question, and one option is using the plugin Edit Flow.

    It can be configured to display custom post_status in specific CPT’s, but further tests are necessary to see if it applies to this case.


    Other option is using toscho’s Retranslate plugin, where you can define the string to be translated and the post_type: https://wordpress.stackexchange.com/a/3675/12615

    It gets almost all the job done, because, curiously, there’s one string (the very first one of the screenshot) that don’t gets translated and one extra code is necessary:

    add_filter( 'views_edit-employee', 'wpse_54330_custom_draft_translation', 10, 1);
    
    function wpse_54330_custom_draft_translation( $views ) 
    {
        $views['draft'] = str_replace('Draft', 'Unavailable', $views['draft']);
        return $views;
    }
    

    One caveat of this method is that just after “quick editing” the post status, the word Draft appears…