#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)
Change History (5)
Note: See
TracTickets for help on using
tickets.
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);