WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11191 closed defect (bug) (fixed)

Add new action: add_tag_form_fields to edit-tags.php

Reported by: gcorne Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9
Component: Taxonomy Keywords:
Focuses: Cc:

Description

To be consistent with the edit_tag_form_fields action, there should be an add_tag_form_fields action between the description and the submit button. This would make it easier to save/edit data associated with a particular term when building advanced custom taxonomy systems.

Attachments (1)

11191.edit-tags.patch (605 bytes) - added by gcorne 4 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 gcorne4 years ago

Use Case:
I have created a plugin that does two things: (1) allows slug for a term to be managed, and (2) allows a landing page to specified that overrides the wordpress-taxonomy page. The use case for the second feature is not as common as the first, essentially by sending the wordpress to an actual page, there are more options for integrating other content with the listing of posts in a given term.

The hooks to make it work are below. Note: that that if you are simply adding args to wp_insert_term and wp_update_term you just have to carefully name your fields because $_POST is passed along.

create the form elements
add_action('add_tag_form_fields', 'bu_taxonomy_term_fields', 1, 1);
add_action('edit_tag_form_fields', 'bu_taxonomy_term_fields', 1, 1);

save the data
add_action('created_' . $tax->name, 'bu_term_saved', 1, 2);
add_action('edited_' . $tax->name, 'bu_term_saved', 1, 2);

gcorne4 years ago

comment:2 brianlayman4 years ago

Ohhh, how interesting... I could see a use for that landing page... hmm neat idea.
+1

comment:3 dd324 years ago

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

(In [12941]) Migrate Category Edit UI hooks, Standardise on custom-taxonomies hooks, add custom-fields for taxonomies UI hooks. See #11838, Fixes #11191

comment:4 nacin4 years ago

  • Component changed from General to Taxonomy
  • Milestone changed from Unassigned to 3.0
Note: See TracTickets for help on using tickets.