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?
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';