Created
February 16, 2014 07:09
-
-
Save annalinneajohansson/f098718f82429dbb553f to your computer and use it in GitHub Desktop.
Custom columns on custom taxonomy terms in admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Custom columns on edit terms screens i admin | |
* */ | |
add_filter( 'manage_edit-{taxonomy-slug}_columns', 'hip_{taxonomy-slug}_columns_head' ); | |
add_filter( 'manage_{taxonomy-slug}_custom_column', 'hip_{taxonomy-slug}_columns_content_taxonomy', 10, 3 ); | |
function hip_{taxonomy-slug}_columns_head( $columns ) { | |
unset( $columns['posts'] ); // unset the posts column | |
unset( $columns['slug'] ); // unset the slug column | |
$columns['new_column'] = __( 'New column heading', 'textdomain' ); | |
return $columns; | |
} | |
function hip_{taxonomy-slug}_columns_content_taxonomy( $deprecated, $column_name, $term_id ) { | |
if ( $column_name == 'new_column' ) { | |
$foobar = 'Foobar!'; | |
echo $foobar; | |
} | |
return $columns; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment