That script doesn’t allow sorting, just displaying a custom column. Is that the original script or the modified one?
Note that register_post_type() and register_taxonomy() shouldn’t be called directly, but in a callback hooked to the ‘init’ action. Working version:
function my_init() {
register_post_type( 'frog', array(
'labels' => array(
'name' => 'Frog',
'singular_name' => 'Frog',
'add_new' => 'Add New',
'add_new_item' => 'Add New frog',
'edit_item' => 'Edit frog',
'edit' => 'Edit',
'new_item' => 'New frog',
'view_item' => 'View frog',
'search_items' => 'Search frogs',
'not_found' => 'No frogs found',
'not_found_in_trash' => 'No frogs found in Trash',
'view' => 'View frog'
),
'public' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'query_var' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'custom-fields', 'comments' ),
'taxonomies' => array('category','post_tag')
)
);
register_taxonomy(
'frog_category',
'frog',
array(
'hierarchical' => true,
'label' => 'Categories',
'public' => true,
'query_var' => true,
'show_tagcloud' => true,
'rewrite' => Array(
'slug' => 'frog_category')
)
);
}
function add_new_frogcolumns($defaults) {
$defaults['frog_cats'] = __('Categories');//frog_cats relates to?
return $defaults;
}
function add_frogcolumn_data( $column_name, $post_id ) {
if( $column_name == 'frog_cats' ) {
$_posttype="frog";
$_taxonomy = 'frog_category';
$terms = get_the_terms( $post_id, $_taxonomy );
if ( !empty( $terms ) ) {
$out = array();
foreach ( $terms as $c )
$_taxonomy_title = esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display'));
$out[] = "<a href="https://wordpress.stackexchange.com/questions/8903/edit.php?frog_category=$_taxonomy_title&post_type=$_posttype">$_taxonomy_title</a>";
echo join( ', ', $out );
}
else {
_e('Uncategorized');
}
}
}
add_action('init', 'my_init');
add_filter( 'manage_frog_posts_columns', 'add_new_frogcolumns' );
add_action( 'manage_frog_custom_column', 'add_frogcolumn_data', 10, 2 );