Skip to content

Instantly share code, notes, and snippets.

@imelgrat
Last active August 23, 2017 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imelgrat/d90b60cc73704cefdeda4d746f93d543 to your computer and use it in GitHub Desktop.
Save imelgrat/d90b60cc73704cefdeda4d746f93d543 to your computer and use it in GitHub Desktop.
Add a custom column to Wordpress Post management page after title column: Full article at: http://imelgrat.me/wordpress/customize-wordpress-post-management-page/
add_filter('manage_posts_columns', 'add_column_middle'); // Register filter
function add_column_middle($defaults)
{
$new_columns = array(); // Create empty array to store new column order
foreach ($defaults as $key => $value)
{
$new_columns[$key] = $value; // Add columns to new array
if ($key == 'title')
{
// when we find the title column
$new_columns['wordcount'] = 'Word count'; // Add the word-count column after title column
}
}
return $new_columns;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment