0

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?

0

1 Answer 1

1

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.

3
  • 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, 2012 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! Apr 19, 2012 at 9:55
  • Waw...it works. I found the correct array circle. Thanks...
    – dev-jim
    Apr 19, 2012 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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