Wordpress - How to add custom columns to Custom Post Type admin screen

The code from ThinkVitamin is right. I think the problem came from else where in your code.

Actually, the hook manage_edit-${post_type}_columns takes an argument $columns which is an array of all registered columns. To add a new column, just add a new element to this array, like this:

add_filter('manage_edit-film_columns', 'my_columns');
function my_columns($columns) {
    $columns['views'] = 'Views';
    return $columns;
}

It´s even easier than you belive.

You have this two functions on wp:

manage_posts_columns (notice the "posts" part)

and

manage_posts_custom_column (again "posts")

You have same thing for pages, "manage_page_posts_columns" and "manage_page_posts_custom_column" (notice the "page_posts" part)

So, if you need to add those cols for x post type, you only need to do like this, le´t say your custom post type name is "movie", then:

manage_movie_posts_columns()
manage_movie_posts_custom_column()

Notice the "movie_posts" part, that´s why you see something like "manage_{custom_type}_posts_columns" on codex pages.

For a "books" custom type:

manage_books_posts_columns()
manage_books_posts_custom_column()

And so on... got it?


Take a look at how the rewrite $arg for your custom post type is.

To get a better view of the output data, just do something like

echo '<pre>';   
print_r($custom_post_type_obj);   
echo '</pre>';   

on the post type object when querying it.