在我的插件文件中,我试图将内容添加到编辑自定义post类型的自定义分类的屏幕上。不幸的是什么都没有出现..。
<?
// 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 );
?>我就是这样注册分类法的:
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'
)
)
);我希望在屏幕上看到“你好”

谢谢你帮忙!
发布于 2019-08-22 13:39:15
使用tha-seminar-category_add_form_fields操作在新类别页面上显示。tha-seminar-category_edit_form_fields用于类别的编辑页面。
https://wordpress.stackexchange.com/questions/345658
复制相似问题