do_action( "{$taxonomy}_edit_form_fields", WP_Term $tag, string $taxonomy )

Fires after the Edit Term form fields are displayed.


Description Description

The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.


Top ↑

Parameters Parameters

$tag

(WP_Term) Current taxonomy term object.

$taxonomy

(string) Current taxonomy slug.


Top ↑

Source Source

File: wp-admin/edit-tag-form.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Mahdi Yazdani

    Adding custom meta fields to a taxonomy.

    Note that in this example name of the input is set to be an array. If the field name was not an array, then you’d have to save each field individually.

    // Key of your custom taxonomy goes here.
    // Taxonomy key, must not exceed 32 characters.
    $prefix_taxonomy = 'category';
    
    /**
     * This will add the custom meta field to the add new term page.
     *
     * @return void
     */
    function wporg_prefix_add_meta_fields() {
    	?>
    
    	<div class="form-field term-meta-wrap">
    		<label for="term_meta[custom_term_meta]">
    			<?php esc_html_e( 'Example meta field', 'textdomain' ); ?>
    		</label>
    		<input type="text" name="term_meta[custom_term_meta]" id="term_meta[custom_term_meta]" value="" />
    		<p class="description">
    			<?php esc_html_e( 'Enter a value for this field.', 'textdomain' ); ?>
    		</p>
    	</div>
    	
    	<?php
    }
    add_action( sprintf( '%s_add_form_fields', $prefix_taxonomy ), 'wporg_prefix_add_meta_fields' );
    

You must log in before being able to contribute a note or feedback.