您只是在重复术语列表。因此,它将生成前端路径。你必须这样改变。
$post_type= get_post_type($post->ID );
$term_list = wp_get_post_terms($post->ID, \'ticketcat\', array("fields" => "all"));
echo \'<a href="\'.admin_url( \'edit.php?post_type=\' . $post_type ) . \'&ticketcat=\'.$term_list[0]->slug.\'" > \'. $term_list[0]->name.\' </a>\';
首先获取帖子类型及其术语名称和slug,然后在自定义echo的帮助下显示结果。这里是您正在寻找的完整函数。
function my_custom_columns($column){
global $post;
$custom = get_post_custom();
switch ($column) {
case \'ticketcat\' :
//echo get_the_term_list($post->ID, \'ticketcat\', \'\', \', \',\'\');
$post_type= get_post_type($post->ID );
$term_list = wp_get_post_terms($post->ID, \'ticketcat\', array("fields" => "all"));
echo \'<a href="\'.admin_url( \'edit.php?post_type=\' . $post_type ) . \'&ticketcat=\'.$term_list[0]->slug.\'" > \'. $term_list[0]->name.\' </a>\';
break;
case \'author_role\' :
$get_author_role = get_userdata($post->post_author);
echo implode(\', \', $get_author_role->roles);
break;
case \'ref\' :
echo get_post_meta($post->ID, \'employer_ref\', true);
break;
}
}
add_action(\'manage_posts_custom_column\', \'my_custom_columns\');