Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I found that the title of the meta box cannot change via the cctm plugin. It shows "Custom Fields" as default, which is pretty annoying to see.

Image

So I decided to change it in function.php, here is my code :

add_filter('add_meta_boxes', 'change_meta_box_titles');
function change_meta_box_titles() {
$wp_meta_boxes['my_post_type']['normal']['core']['cctm_default']['title']= 'Details';}

But it failed to work, any idea?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to declare the $wp_meta_boxes array as global:

global $wp_meta_boxes; 

If it still doesn't work try:

add_filter('add_meta_boxes', 'change_meta_box_titles');
function change_meta_box_titles() {
    global $wp_meta_boxes;
    echo '<pre>';
    print_r($wp_meta_boxes);
    echo '</pre>';
}

to see what's going on (and to check where the title is). You should also prefix your function names to prevent a clash with WP or other plug-ins.

share|improve this answer
    
Hi,I added the global $wp_meta_boxes; but still not working, and your function cause me a fatal error where causing fails to access the entire site. i also try prefix, no luck as well. –  dev-jim Apr 19 '12 at 9:15
    
There was a missing semi-colon after global $metaboxes. I've edited the answer. The prefix won't solve the problem - but it may prevent you encountering another one! –  Stephen Harris Apr 19 '12 at 9:55
    
Waw...it works. I found the correct array circle. Thanks... –  dev-jim Apr 19 '12 at 10:40

Your Answer

 
discard

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.