I've got a plugin that attaches itself to both the post and page editors to read and write to the post_content object. I'd like to also attach my plugin to the category manager edit screen.

In the code below, lines 1 and 2 attach it to the post and page editor, but line 3, a shot in the dark, is not yet doing the trick. Any ideas on the proper way to do it?

if ( function_exists('add_meta_box') ) { 
    add_meta_box('My-plugin', __('My plugin'), 'My_plugin_callback', 'post', 'side', 'high');
    add_meta_box('My-plugin', __('My plugin'), 'My_plugin_callback', 'page', 'side', 'high'); 
//???   add_meta_box('My-plugin', __('My plugin'), 'My_plugin_callback', 'category', 'side', 'high');

I'm pretty sure that even if you add that meta box at the bottom of the category edit you will still have the problem of meta table for categories, and i bet that your meta_box 'save' function saves as postmeta data table.

However this can be done using the options table here is an how to add extra fields to categories

Hope this helps

  • @בניית אתרים: Thanks. I've already got a few extra fields on my category edit screen using the "edit_category_form" add_filter. I'm just trying to see if there's an add_meta_box hook on that screen to make this as simple as it was to add the interface to the post and page editors.
    – Scott B
    Feb 15 '11 at 17:06
  • 1
    @Scott B: I'm afraid it's not that simple but its not that hard either, if you already have a extra fields then create a new function based on your meta-box display function, and change it a bit to display on the category edit form using 'edit_category_form' filter and create another function based on your meta-box save function and change it a bit to save on the category extra fields instead of postmeta and hook that to 'edited_category' filter
    – Bainternet
    Feb 15 '11 at 17:31
  • That sounds like a plan. Let me work on it and see what I can come up with. Thanks for taking time to explain that.
    – Scott B
    Feb 15 '11 at 21:27
  • +1 for best answer considering there the answer to the original question appears to be "No" :-)
    – Scott B
    Feb 19 '11 at 15:37
  • This answer and the tutorial link provided are quite old and contain deprecated stuff - to new stuff - check my answer on this topic on stackoverflow :) :: stackoverflow.com/a/36033019/1835470
    – jave.web
    Mar 16 '16 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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