In my plugin file, I'm trying to add content to the screen where custom taxonomy of custom post type is edited. Unfortunatelly nothing appears...
<?
// A callback function to add a custom field to our taxonomy
function my_custom_fields() {
?>
<tr class="form-field">
<td>
hello
</td>
</tr>
<?
}
// Add the fields to the taxonomy, using our callback function
add_action( 'tha-seminar-category_edit_form_fields', 'my_custom_fields', 10, 2 );
?>
This is how I register the taxonomy:
register_taxonomy('tha-seminar-category', 'tha_seminars',
array("hierarchical" => true,
"label" => "Tha Seminar Categories",
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_tagcloud' => true,
'_builtin' => false,
'show_in_nav_menus' => true,
'show_in_rest' => true,
'show_in_quick_edit' => true,
'capabilities' => array(
'manage_terms' => 'edit_tha_seminars',
'edit_terms' => 'edit_tha_seminars',
'delete_terms' => 'edit_tha_seminars',
'assign_terms' => 'edit_tha_seminars'
)
)
);
The screen I expect to see "hello" at
Thanks for help!
In my plugin file, I'm trying to add content to the screen where custom taxonomy of custom post type is edited. Unfortunatelly nothing appears...
<?
// A callback function to add a custom field to our taxonomy
function my_custom_fields() {
?>
<tr class="form-field">
<td>
hello
</td>
</tr>
<?
}
// Add the fields to the taxonomy, using our callback function
add_action( 'tha-seminar-category_edit_form_fields', 'my_custom_fields', 10, 2 );
?>
This is how I register the taxonomy:
register_taxonomy('tha-seminar-category', 'tha_seminars',
array("hierarchical" => true,
"label" => "Tha Seminar Categories",
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_tagcloud' => true,
'_builtin' => false,
'show_in_nav_menus' => true,
'show_in_rest' => true,
'show_in_quick_edit' => true,
'capabilities' => array(
'manage_terms' => 'edit_tha_seminars',
'edit_terms' => 'edit_tha_seminars',
'delete_terms' => 'edit_tha_seminars',
'assign_terms' => 'edit_tha_seminars'
)
)
);
The screen I expect to see "hello" at
Thanks for help!
Share Improve this question asked Aug 22, 2019 at 11:48 FankyFanky 3171 silver badge12 bronze badges 1- Your screenshot is of the new term form. If you click to edit a term do you see your field? – Jacob Peattie Commented Aug 22, 2019 at 12:54
1 Answer
Reset to default 2Use tha-seminar-category_add_form_fields
action to show on new category page.
tha-seminar-category_edit_form_fields
is for the edit page of the category