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 got some custom post types where i deregistered the "title" meta box. Now i always get "Auto Draft" as title. To avoid this i'd like to add the name of a taxonomy as the title. But how would i check if the meta box "title" exists or not?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Check the metabox global directly?

$wp_meta_boxes['YOURTYPE'] should hold data on metaboxes for a given type.

Had a quick look in wp-admin/includes/template.php but i can't see any convenience functions for extracting metabox information from the array so you'll probably need to create your own code to loop over or extract the necessary info from it.

Of course make sure you run your code after the add_meta_boxes actions(else they'll likely not exist at the point you run your code).

share|improve this answer
    
It's exactly (or better said, should exactly be - no success so far): $wp_meta_boxes['bills']['high']['post_title'] –  kaiser Feb 24 '11 at 17:28
    
That'll be because the title is not a metabox, maybe run your conditional logic in the same way core does decides whether to show that field, ie. if ( post_type_supports( 'bills', 'title') ) { ? –  t31os Feb 24 '11 at 17:37

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.