Custom Columns on Post Administration Pages

You can now add Custom Columns to Post Administration Pages especially when you are using Custom Post Types. The snippets of code below will help you set up new columns for your post type pages in no time.

add_filter('manage_edit-_columns', 'column_columns');
function column_columns($columns) {
    $columns['column_name'] = 'Column Name';
    return $columns;
}

the above code will register your new Column to the current columns of your Custom Post types. Remember to change <custom post type> with the singular post type name.

add_action('manage_posts_custom_column',  'column_show_columns');
function column_show_columns($name) {
    global $post;
    switch ($name) {
        case 'column_name':
		echo 'Column Value';
        break;
    }
}

The code above will show the value for each row for the selected column specified by your column name.

add_action('admin_head',  'column_admin_head');
function column_admin_head() {
?>


and to top it off. style it with your own CSS through the admin head hook.

Leave a Reply