Opened 17 years ago
Closed 17 years ago
#12171 closed defect (bug) (fixed)
add_category_form_fields Action Fires Twice
| Reported by: | blepoxp | Owned by: | dd32 |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | Taxonomy | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
17 years ago
- Keywords has-patch added; dev-feedback removed
- Owner changed from to
- Status new → assigned
#3
@
17 years ago
Added a second patch to prevent add_tag_form_fields from firing twice in case a taxonomy called "tag" is registered.
#4
@
17 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
@
17 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
@
17 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
@
17 years ago
I've got a hybrid of mine and nacin's code running locally which i'll finish testing later today.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Better patch.