Last active
August 23, 2017 18:11
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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