Quick Tip: Add Custom Columns in WordPress Manage Screens

This quick tip explains how to add a Custom Column in the Manage Screens of your WordPress blog.


Here are some code snippets you can use to customize the columns in your Manage Screens.

You can copy and paste them into your theme's functions.php file, or download the plugin attached to this post.


Step 1 Define Column Functions

First, let's define some helper functions that we will hook into WordPress later. The first two add the new column (or two columns, or remove a default one), while the others display the column content. In these examples we assume that you have already activated a movie Custom Post Type and a genre Custom Taxonomy. You can read about creating custom post types and taxonomies in a previous article.

Step 2 Hook the Column Functions to WordPress

Now, let's hook the functions into WordPress Manage Screens:

Posts and Post Types, Except Pages

Only WordPress Default Posts

Only WordPress Default Pages

Only Movie Custom Post Type

Post Categories

Only Genre Custom Taxonomy

Post Tags

Link Categories

Media Library

Users


Final Notes

Two final notes: if a Manage Screen has no items, for example there are no Tags yet, the content of the new column is not displayed.

The ST4_columns_content_users function it's slightly different from the others, since it returns a PHP variable containing the HTML, instead of printing the column content on the fly.

Tags:

Comments

Related Articles