admin管理员组文章数量:1415420
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
本文标签: taxonomyeditformfields not working
版权声明:本文标题:{$taxonomy}_edit_form_fields not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745226695a2648639.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论