Change Title Of Meta Boxes?

I’m trying to create a function that would allow me to change the title of an established meta box (i.e, change Meta Box title ‘Authors’ to ‘Team’, etc.)

I didn’t want to use JS or have to unset the original meta box and re-add it.

I started off with the following:


// hook to the 'add_meta_boxes' action
add_action('add_meta_boxes', 'change_meta_box_titles');
function change_meta_box_titles($post_type, $post)) {
    global $wp_meta_boxes; // array of defined meta boxes
    // cycle through the array, change the titles you want
}

I’m stuck on the part to “cycle through the array and change the titles you want”. What would be the best way to accomplish this? Using a foreach to loop? Or a Switch/Case scenario? Could anyone possibly give me an example of how to accomplish this?

This plugin might be easier: http://wordpress.org/extend/plugins/advanced-custom-fields/

Thanks for the suggestion, but not what I was looking to do(I already know how to create meta’s and custom fields). I wanted to change the Title of pre-existing boxes.

I found a semi-solution for this. The following will allow you to change the titles of “Core Meta Boxes” but for some reason won’t work with custom meta boxes:

//hook to the 'add_meta_boxes' action
add_action('add_meta_boxes', 'change_meta_box_titles');
function change_meta_box_titles() {
    global $wp_meta_boxes; // array of defined meta boxes
    // cycle through the array, change the titles you want
    $wp_meta_boxes['post']['normal']['core']['authordiv']['title']= 'Team Member';
}

An example of a custom meta (using a custom post type) not working, that I mentioned above would be:

$wp_meta_boxes['portfolio']['side']['high']['cc_projectinfo_meta']['title']= 'A New Title';

In theory the above should work, but it doesn’t.

The reason I suggested the plug in, was two reasons:

  1. Depending where you are putting the solution code, may cause some frustration, such as if you store it in a theme and change themes.
  2. While I didn’t study the a plugin in detail, it looks like it collects all custom fields. Which would save energy down the road or if you did #1 (: