WordPress: Adding custom columns to wp-admin posts overview

Adding custom columns to the posts overview from wp-admin is maybe simpler as you think.  You need just two hooks, one is an action named “manage_posts_custom_column” and the other one is a filter named “manage_posts_columns”.

Add custom column

With the filter “manage_posts_columns” you can add your custom column to the overview table of the posts. In my case I made the filter a little bit more complex, because I want control of the column order. The default order from wordpress is

  1. cb
  2. title
  3. author
  4. categories
  5. tags
  7. date
and normaly wordpress adds your custom column after “date”. In my filter function I walk with a while-loop through the default columns and add my column right after the “author” column:
    public static function addCustomColumn($defaults) {

        $newDefaults = array();
        while ($default = current($defaults)):
            $key = key($defaults);
            $newDefaults[$key] = $default;
            if ($key == "author"):
                $newDefaults["my_column"] = "My Column Name";

        return $newDefaults;

If you have a more sexy solution for this, tell me :)

Adding content to your costum column

Next and final step is adding the content to your custom colum/row with the action-hook “manage_posts_custom_column”. The action takes the column-name and the post_id of the current row:

public static function showCustomColumnContent($columnName, $postId) {

        if($columnName == "my_column"):
            echo "my column content for post_id " . $postId;

Custom columns only for a custom post type

If you want your custom column only in a custom posty, e.g. to display a custom taxonomy, then simply add the name of your custom post type to the name of the hook.

For example:

Action hook “manage_yourcustomposttypename_posts_custom_column”

Filter hook “manage_yourcustomposttypename_posts_columns”

Full example plugin code



Change WordPress 3.2 HTML-Editor Font

A good friend of me was not happy with the new HTML-Editor font in WordPress 3.2. So I wrote him a plugin to bring back the “old” font to WordPress 3.2.



  1. Upload the whole plugin-folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Write a new post with the HTML-Editor and enjoy