function wporg_register_taxonomy_instructor()
{
$labels = [
\'name\' => _x(\'Instructors\', \'taxonomy general name\'),
\'singular_name\' => _x(\'Instructor\', \'taxonomy singular name\'),
\'search_items\' => __(\'Search Instructors\'),
\'all_items\' => __(\'All Instructors\'),
\'parent_item\' => __(\'Parent Instructor\'),
\'parent_item_colon\' => __(\'Parent Instructor:\'),
\'edit_item\' => __(\'Edit Instructor\'),
\'update_item\' => __(\'Update Instructor\'),
\'add_new_item\' => __(\'Add New Instructor\'),
\'new_item_name\' => __(\'New Instructor Name\'),
\'menu_name\' => __(\'Instructor\'),
];
$args = [
\'hierarchical\' => true, // make it hierarchical (like categories)
\'labels\' => $labels,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'query_var\' => true,
\'rewrite\' => [\'slug\' => \'instructor\'],
];
register_taxonomy(\'instructor\', [\'post\'], $args);
}
add_action(\'init\', \'wporg_register_taxonomy_instructor\');
我使用此代码向name讲师注册自定义分类法,但当我单击get\\u term\\u link($term->term\\u id)生成的链接时,我将进入404页。