{$分类}_EDIT_FORM_FIELS不工作

时间:2019-08-22 作者:Fanky

在我的插件文件中,我试图将内容添加到编辑自定义帖子类型的自定义分类法的屏幕中。不幸的是,什么都没有出现。。。

<?
// 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\'
    )
)
);
我希望在屏幕上看到“hello”enter image description here

谢谢你的帮助!

1 个回复
最合适的回答,由SO网友:James John 整理而成

使用tha-seminar-category_add_form_fields要在新类别页面上显示的操作。tha-seminar-category_edit_form_fields 用于类别的编辑页

相关推荐