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 want to add few custom fields to categories. So I am looking for something like add_meta_box but for categories.

Is there any WP function like that for categories?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

You can add content to the category edit pages by hooking into the edit_category_form_fields (still in the form table) or edit_category_form (outside the table but before the submit button). Similar hooks exist for tags or custom taxonomies, check the source. To handle these extra values you need to find a good hook yourself, make sure you handle it before editedtag redirects you.

There are no clean meta box handlers, you need to write most code yourself. But please let us know how you did it, it might be interesting for others!

share|improve this answer
    
thank you Jan, it looks good –  Radek Oct 20 '10 at 0:02
    
maybe do_meta_boxes is helpful with this: codex.wordpress.org/Function_Reference/do_meta_boxes –  ungestaltbar Jan 31 '12 at 11:22

this hook works only for original WP categories. Is there any solution/hook how to add custom form fields to custom category (taxonomy) type? Thanx

share|improve this answer
1  
Indeed, in the source you can see that edit_tag_form_fields fires for everything that is not a category, and [taxonomy name]_edit_form_fields then again for all taxonomies (so people_edit_form_fields for a people taxonomy, but also category_edit_form_fields again for a category). And I know you can't comment yet, but once you can, you should do that instead of adding a new "answer" to ask a clarification. Otherwise it might get ignored. –  Jan Fabry Oct 30 '10 at 14:17

it's pretty alpha... but this was supposed to be a branch off of the awesome WP_Alchemy which kicks butt at regular metaboxes

https://github.com/farinspace/wpalchemy/tree/taxonomy

share|improve this answer

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.