Opened 15 years ago
Closed 15 years ago
#12171 closed defect (bug) (fixed)
add_category_form_fields Action Fires Twice
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
The add_category_form_fields action fires twice in /wp-admin/edit-tags.php on line 341 - 345 in trunk with r. 13020.
This seems to happen because add_category_form_fields gets called and then 'add_' . $taxonomy . '_form' gets called.
I can submit a patch once I know which do_action needs to be removed.
if ( 'category' == $taxonomy ) do_action('edit_category_form', (object)array('parent' => 0) ); else do_action('add_tag_form', $taxonomy); do_action('add_' . $taxonomy . '_form', $taxonomy);
Attachments (4)
Change History (16)
#2
@
15 years ago
- Keywords has-patch added; dev-feedback removed
- Owner changed from filosofo to dd32
- Status changed from new to assigned
#3
@
15 years ago
Added a second patch to prevent add_tag_form_fields from firing twice in case a taxonomy called "tag" is registered.
#4
@
15 years ago
A few things can be done here, However, I'm wondering if it'd be best to rename the new hook to avoid the conflict instead.
Eg, Change it from do_action('add_' . $taxonomy . '_form_pre', $taxonomy);
to do_action($taxonomy . '_add_form_pre', $taxonomy);
This'd allow for the new generic hook to apply to categories, whilst also having the backwards compat for the old category actions args the same.
#5
@
15 years ago
The reasoning for the renaming, is to allow for the current category hooks to continue to operate, however provide a exact and known hook for all future plugin developers to rely on (without having to add a special function to handle the category hook)
#6
@
15 years ago
Correct, I'm going through and running into problems at the hooks starting at L 292, which are the ones included above (though not the action referred to in the ticket summary).
Throwing up the third patch to address the other code blocks. I agree with renaming so I'll include that as well.
#7
@
15 years ago
I've got a hybrid of mine and nacin's code running locally which i'll finish testing later today.
Better patch.