How to Quickly Rename a WordPress Post Format

Post Formats is a really cool theme feature added in WordPress 3.1. It’s a standardized core feature available to any WordPress theme that supports it.

However, you’re not really encouraged to create your own custom post formats. This is because post formats are meant to transfer across themes. If you were to create your own unique post format, your posts would not display correctly if you switched to a theme that only supports the standardized post formats.

If you feel like you need to create your own post format, the recommended method would be to register a custom taxonomy, which is really what the post formats feature is anyway. WordPress couldn’t make it any easier for you. Just follow the directions in the codex and get creative with all of the options.

But what if you just want to rename an existing post format? Perhaps the format itself works for you but the label on it is confusing for authors and/or readers. Maybe you’re using a theme that supports and styles all of the standard post formats and everything works perfectly for you, except you’d rather have a different label for one of them.

In this example. let’s say we want to rename ‘Aside’ to be ‘Tip’ instead. Here’s a quick tip I found in the WordPress stack exchange. It is simply for presentation – it doesn’t do anything else. Think of this more as an illusion.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function rename_post_formats( $safe_text ) {
    if ( $safe_text == 'Aside' )
        return 'Tip';

    return $safe_text;
}
add_filter( 'esc_html', 'rename_post_formats' );

//rename Aside in posts list table
function live_rename_formats() { 
    global $current_screen;

    if ( $current_screen->id == 'edit-post' ) { ?>
        <script type="text/javascript">
        jQuery('document').ready(function() {

            jQuery("span.post-state-format").each(function() { 
                if ( jQuery(this).text() == "Aside" )
                    jQuery(this).text("Tip");             
            });

        });      
        </script>
<?php }
}
add_action('admin_head', 'live_rename_formats');

Add this snippet to your functions.php file and edit it in the two places where you see the original post format, followed by your new name for it. Again, this is just a quick little hack for presentation only. Hopefully it will come in handy for some of you.

Need a little bit more background on Post Formats? Check out Siobhan’s article about how they are used in the Twenty Eleven theme: Twenty Eleven Post Formats – What Are They and Why Should I Care?

Comments (25)

  1. is this commenting system a plugin that I could use on my site? I really like the tabs for the different networks – WordPress, Twitter, Facebook & Google. I would appreciate any additional info you could offer. Thanks.

  2. Great hack!

    I use a child theme of Twenty Eleven on my blog and I would like to rename “Link” format to “Bookmark”. I followed your instructions and added the piece of code above to functions.php. The post format has been renamed successfully, but in my blog, above the post of this format, it still says “Link” and not “Bookmark”. Any ideas to fix this?

    Thank you.

  3. Thank you for this code,

    I now have renamed Aside to something else,

    But what if i also want to rename Standard and Gallery to something else?
    for me this is only back-ended i don’t care what it is called in the source code.
    I just want to make it look-/sound more friendly to pick from for the person who has to work with this WP website.

    I made three different blog-post layout (small, wide and center) So it would also be cool if it’s not called standard , Aside and Gallery in the admin.

    I try to multiple this code (copy-/paste) above but WP get a white screen :(

    thanks

    • Nope the code works..

      Just copy-/paste it at the very bottom of the functions.php make sure it’s not between any other function.
      Just keep a few line empty.

      If you end up with errors it’s prob. not form this one.

      OnTopic.

      It’s just very sloppy from WordPress we can’t change the names of those Post Formats at the backend.
      BOOOO.

  4. By the way, I am using the twenty eleven theme. I tried adding “standard” to add theme support post formats but that ended up giving me two “Standard” lines, but one was changed to “review” like I wanted it to be…

  5. @ adminrimma,

    For this code above.
    It works. But it only works on ONE Post Format at the same time.

    If you have made it work for changing Aside + Gallery at one snippet code please post the code because i can only change one Post Format at the same time.

    And Standard is ruled out you can’t change the name of Standard because if none Post Format is selected at the Admin sidebar it will autom. fall back to Standard Post Format.

    You can change all the other names of the Post Fromats if you like but you have to look inside the wp-includes folder of the Core WP files and open the file post.php search for this line of code function get_post_format_strings (at line 5126) below there is a list of the 7 possible Post Formats and if you change the names of the second column (with the Capitalized-letters) and save the file you have changed the names at the Admin sidebar only.

    *** But do remember if you update your WordPress website in the future those changes will be gone and you have to redo it again. ***

    • I think function get_post_format_strings (at line 5126) found and add your customized fields good idea. And we need add same strings to theme\yourtemplate\functions.php at line 29 after post-formats line.
      it should be same name with your added post.php file.
      Before edit the functions.php shown as array(‘aside’, ‘gallery’, ‘link’, ‘image’, ‘quote’, ‘status’, ‘video’, ‘audio’, ‘chat’); but we can add same parameters after these and we can solve this problem.
      I solved that with this sytle.

  6. I was experimenting to get the standard post format to accept a name change — I went in to my functions file and added “standard” to the array in add theme support post formats () (Line 104) and interestingly, in the admin area both standard and review (my name change) post types displayed….my thought is that the system thought it was a custom post type that I named “standard” and this is the reason for the strange behavior? But anyhow, your explanation makes sense to me. You can replicate it by doing the same thing (not sure you’d want to, though).

    So, in reality, I was not able to change more than one post type, yet. If I do, I will certainly post here.

    Thanks!

  7. … in my last post, the code didn’t display correctly.
    if ( jQuery(this).text() == “OPEN HERE NEW PHP SESSION” )

    Paste inside : _ex( ‘Aside’,’Post format’ )

  8. This works really well. Agree with other comments that getting it to change more than one format name would be seriously helpful.

    One other thing is that it doesn’t change the class name that’s outputted in the post html, and it doesn’t change the label in the admin panel. When you’re looking at all the posts, there’s a little “- Image” or “- Audio” next to the titles of the posts. It still says “- Aside” even though the name is different in the edit post screen. Changing in all those places would be a necessity for the plugin, if possible.

    Last thing, if “Standard” can’t be changed, perhaps it can be hidden?

  9. For all you idiots that want to do this to two post formats, simply duplicate the function as follows (note the number “2″):

    function rename_post_formats2( $safe_text ) {
    if ( $safe_text == ‘Gallery’ )
    return ‘NEW POST FORMAT’;

    return $safe_text;
    }
    add_filter( ‘esc_html’, ‘rename_post_formats2′ );

    //rename Aside in posts list table
    function live_rename_formats2() {
    global $current_screen;

    if ( $current_screen->id == ‘edit-post’ ) { ?>

    jQuery(‘document’).ready(function() {

    jQuery(“span.post-state-format”).each(function() {
    if ( jQuery(this).text() == “Gallery” )
    jQuery(this).text(“NEW POST FORMAT”);
    });

    });

    <?php }
    }
    add_action('admin_head2', 'live_rename_formats2');

Participate