Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12171 closed defect (bug) (fixed)

add_category_form_fields Action Fires Twice

Reported by: blepoxp's profile blepoxp Owned by: dd32's profile dd32
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)

12171.diff (445 bytes) - added by nacin 15 years ago.
12171.2.diff (776 bytes) - added by nacin 15 years ago.
Better patch.
12171.4.diff (2.5 KB) - added by dd32 15 years ago.
12171.3.diff (3.5 KB) - added by nacin 15 years ago.
Addresses some more collisions

Download all attachments as: .zip

Change History (16)

#1 @blepoxp
15 years ago

  • Cc glenn@… added

#2 @nacin
15 years ago

  • Keywords has-patch added; dev-feedback removed
  • Owner changed from filosofo to dd32
  • Status changed from new to assigned

@nacin
15 years ago

@nacin
15 years ago

Better patch.

#3 @nacin
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 @dd32
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 @dd32
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 @nacin
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.

@dd32
15 years ago

@nacin
15 years ago

Addresses some more collisions

#7 @dd32
15 years ago

I've got a hybrid of mine and nacin's code running locally which i'll finish testing later today.

#8 @automattor
15 years ago

(In [13035]) Rename new taxonomy page hooks to prevent hook conflicts. See #12171

#9 @dd32
15 years ago

Give that a whirl, and see if it provides a good enough support. All previous hooks should be working the same as they were before.

#10 @dd32
15 years ago

  • Status changed from assigned to closed

#11 @nacin
15 years ago

  • Status changed from closed to reopened

#12 @nacin
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.