anything like add_meta_box for categories?

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?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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!

Method 2

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

Method 3

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments