Menampilkan Word Count di Admin Column

// WORD COUNT
add_filter(‘manage_posts_columns’, ‘iwp_add_column’);
function iwp_add_column($iwp_wordcount_column) {
$iwp_wordcount_column[‘iwp_wordcount’] = ‘Word Count’;
return $iwp_wordcount_column;
}

//Link the word count to our new column//
add_action(‘manage_posts_custom_column’, ‘iwp_display_wordcount’);
function iwp_display_wordcount($name)
{
global $post;
switch ($name)
{
case ‘iwp_wordcount’:
//Get the post ID and pass it into the get_wordcount function//
$iwp_wordcount = iwp_get_wordcount($post->ID);
echo $iwp_wordcount;
}
}

function iwp_get_wordcount($post_id) {
//Get the post, remove any unnecessary tags and then perform the word count//
$iwp_wordcount = str_word_count( strip_tags( strip_shortcodes(get_post_field( ‘post_content’, $post_id )) ) );
return $iwp_wordcount;}