Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#17617 closed defect (bug) (fixed)

"edit_tag_form" action incorrectly performed for categories

Reported by: michaeltyson Owned by: dd32
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.2
Component: Administration Keywords: needs-patch
Focuses: Cc:


There is a typo in wp-admin/edit-tag-form.php (in WP 3.1.3 and trunk, at least) that results in the "edit_tag_form" action being performed for categories, incorrectly.

The attached patch should correct the issue.

Attachments (1)

diff.patch (400 bytes) - added by michaeltyson 9 years ago.

Download all attachments as: .zip

Change History (9)

9 years ago

#1 @ocean90
9 years ago

  • Keywords reporter-feedback added

#3 @nacin
9 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Awaiting Review to 3.2

Regression somehow caused by [15820].

#4 @ocean90
9 years ago

michaeltyson, sorry. I should open my eyes when I read patches. :)

#5 @dd32
9 years ago

  • Keywords needs-patch added; has-patch removed

Looking at that changeset, and the patch here, the changeset includes a few more if's that should be an elseif.

#6 @dd32
9 years ago

Looks like a few other things from that commit had already been fixed (ie. [15823])

Plugins using hooks such as edit_tag_form need to be aware that this hook is also run for any custom taxonomies, The only pages it shouldn't be run on are categories and link categories.

Plugins should instead use the taxonomy-specific actions such as post_tag_pre_add_form, post_tag_add_form, post_tag_pre_edit_form, post_tag_edit_form_fields and post_tag_edit_form.

#7 @dd32
9 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In [18078]:

Correct the logic for Taxonomy edit page actions. Props michaeltyson for initial patch. Fixes #17617

#8 @dd32
9 years ago

Tidbit of code for testing these actions too (dump the filternames when run)

add_action('init', 'taxonomy_form_fields', 10000);
function taxonomy_form_fields() {
	$actions = array('edit_category_form_pre', 'edit_link_category_form_pre', 'edit_tag_form_pre', '_pre_edit_form', 'edit_category_form_fields', 'edit_link_category_form_fields', 'edit_tag_form_fields', '_edit_form_fields', 'edit_category_form', 'edit_link_category_form', 'edit_tag_form', '_edit_form', 'add_category_form_pre', 'add_link_category_form_pre', 'add_tag_form_pre', '_pre_add_form', 'edit_category_form', 'edit_link_category_form', 'add_tag_form', '_add_form');
	foreach ( array_unique($actions) as $action ) {
		if ( '_' != $action{0} )
			add_action($action, 'echo_current_filter');
			foreach ( get_taxonomies() as $tax )
				add_action( $tax . $action, 'echo_current_filter');

	function echo_current_filter() { var_dump(current_filter()); }

Note: See TracTickets for help on using tickets.