[wp-hackers] Inconsistency between the category edit form and the category add form

John R R Leavitt jrrl at jrrl.com
Thu Jan 28 01:33:39 UTC 2010


In the former (in edit-category-form.php), there is an action hook 
(edit_category_form_fields) that allows for the addition of extra fields 
to the form.  These can then be handled by update_terms action hook in 
update_term.  The edit_category_form_fields action, however, is not 
present in the category add form (in categories.php).

I suggest the following change:

--- categories.php      2010-01-27 20:25:03.231789000 -0500
+++ categories-patched.php      2010-01-27 20:25:56.283104500 -0500
@@ -287,7 +287,7 @@
        <textarea name="category_description" id="category_description" 
rows="5" cols="40"></textarea>
     <p><?php _e('The description is not prominent by default; however, 
some themes may show it.'); ?></p>
 </div>
-
+<?php do_action('edit_category_form_fields', $category); ?>
 <p class="submit"><input type="submit" class="button" name="submit" 
value="<?php esc_attr_e('Add Category'); ?>" /></p>
 <?php do_action('edit_category_form', $category); ?>
 </form></div>


This will make the two forms match better in terms for hooks, which is 
nicer for plugin developers.



More information about the wp-hackers mailing list