How to add a custom column to WordPress Pages and Posts table

Blogging is one of the basic features of WordPress. Apparently, Posts and/or Pages section in Admin Screen is where most users spend their time on. In this tutorial, we will go through 2 simple steps on how to add a custom column to WordPress pages and posts table in order to provide the extra information to our users.

Step 1 – Register the hooks to add the column

WordPress provides us two hooks manage_posts_column and manage_pages_column  to register a column’s name and label.

Custom column to WordPress Pages & Posts
Figure 1 – Custom column

Great! It’s super easy, isn’t it? Next step, we will add some HTML element including one checkbox and a link for each row in our custom column.

Step 2 – Generate the row content

We complete this step thanks to two actions mange_posts_custom_column and manage_pages_custom_column that return two parameters $column and $post. We will compare the $column value is same as our custom column name and generate some HTML element then.

Similarity, the below code applies to the page:

Cool! Here is our result for the above snippet:

Figure 2 – Custom column content



With just two simple steps, we can easily create a custom column to WordPress pages and posts table. I hope you can use it to create more advanced features for our WordPress users. If you enjoy it, please subscribe for more useful WordPress tips.