WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a few special needs in terms of post formatting, but do not want (and cannot) break out of the standard Post Format paradigm per best practices.

I've come up with a mapping of WordPress core types to my company's own nomenclature (e.g. show "chat" as "discussion"). I'd like to (from a UI perspective only) rename these post formats to the internal names. I'd like to do this via filters if possible, and not via some JavaScript hack after load.

Is it possible to filter the display name for post formats for display in the Formats meta box?

share|improve this question
up vote 2 down vote accepted

Yes, you can. You can hook right into gettext. The example provided below changes Publish button:

add_filter( 'gettext', 'binda_change_publish_button', 10, 2 );

function binda_change_publish_button( $translation, $text ) {
    //check if this is pizza add or edit page in administration 
    global $pagenow, $typenow;
    if ( is_admin() && ( $pagenow == 'post-new.php' or $pagenow == 'post.php' ) && ( $typenow == 'your_post_type' or ( isset($_GET['post_type']) && $_GET['post_type'] == 'your_post_type') ) ) {
        if ( $text == 'Publish' )
            return 'Save My post type';     
    return $translation;

EDIT: Tried to change Aside to "Postranní" (in Czech) and it works without problem when using another filter gettext_with_context. See example below:

add_filter( 'gettext_with_context', 'binda_change_standart_format_name', 10, 2 );

function binda_change_standard_fromat_name( $translation, $text ) {
    //check if this is pizza add or edit page in administration 
    global $pagenow, $typenow;
    if ( is_admin() && ( $pagenow == 'post-new.php' or $pagenow == 'post.php' ) && ( $typenow == 'post' or ( isset($_GET['post_type']) && $_GET['post_type'] == 'post') ) ) {
        if ( $text == 'Aside' )
            return 'Postranní';     
    return $translation;
share|improve this answer
I just arrived there as well via the _x() method. Thank you! – editor Feb 11 '13 at 21:18
_x will call the filter gettext_with_context. gettext only works for "Standard"... – brasofilo Feb 11 '13 at 21:23
As I mentioned in modified answer, simple 'gettext' filer is working too... – david.binda Feb 11 '13 at 21:24
Check the other strings. – brasofilo Feb 11 '13 at 21:25
U're right. I've updated my answer. Thank you for great point. – david.binda Feb 11 '13 at 21:31

[ Late answer: This is only valid/useful if you want to avoid using a get_text filter -- I always worry about performance using them ]

In 3.5.1, the Formats meta box is rendered on line 305 ( post_format_meta_box ) of "wp-admin/includes/meta-boxes.php".

This function calls "get_theme_support('post-formats')" located in "wp-includes/theme.php" and returns the original add_theme_support value inserted by the theme -- in this case, the array of post formats.

Theres no filter on the return value, just "return $_wp_theme_features[ $feature ];"

An alternative, if you want to avoid using Javascript/jQuery, it is possible to substitute your own Formats meta box by duplicating the code from the post_format_meta_box function with your own custom code:

function add_custom_formats_metabox( )
    remove_meta_box( 'formatdiv' , 'post' , 'side' );
    add_meta_box( 'my-formatdiv', 'Format' , 'render_custom_formats_metabox', 'post', 'side', 'core' );
function render_custom_formats_metabox( $post, $box ) {
    if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
        $post_formats = get_theme_support( 'post-formats' );

        if ( is_array( $post_formats[0] ) ) :
            $post_format = get_post_format( $post->ID );
            if ( !$post_format )
                $post_format = '0';
            if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
                $post_formats[0][] = $post_format;
            <div id="post-formats-select">
                <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0"><?php _e('Standard'); ?></label>
                foreach ( $post_formats[0] as $format ) :
                // implement your own labeling logic here...
                $label = $format === 'chat' ? 'Discussion' : get_post_format_string( $format ) ;
                <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( $label ); ?></label>
                <?php endforeach; ?><br />
        <?php endif; endif;

add_action( 'add_meta_boxes' , 'add_custom_formats_metabox' );
share|improve this answer
Late one but nice one! The performance question is good point. But as long as this is on backend, I would be worry so much... – david.binda Feb 11 '13 at 22:06
Thanks. I hadn't considered wrapping the add_filter() in is_admin(). This sounds like one of those issues that should be in Trac: "get_post_format_strings" functions should have a filter -- considering it's returning a static array. – Jer Feb 11 '13 at 22:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.