--- author: email: mail@petermolnar.net image: https://petermolnar.net/favicon.jpg name: Peter Molnar url: https://petermolnar.net copies: - http://web.archive.org/web/20190624125736/https://petermolnar.net/letter-count-for-wordpress-content-and-excerpt-fields/ lang: en published: '2014-04-12T10:24:41+00:00' summary: How to add a simple character counter to excerpt & content fields in WordPress. tags: - WordPress title: Character count for WordPress content and excerpt fields --- UPDATE (2014-04-24 09:36): I've corrected the JS code by adding a check for the existence of the excerpt and the word counter entries; without this, JS would fail to load on pages and custom posts. I've been looking for a simple letter counter for the WordPress content & excerpt fields, but the only plugin I've found is not working as of WordPress 3.8[^1]. I've also come across with a blog post how to do this for the exceprt[^2], but that was throwing errors, so I corrected it and added the content counter. Add this to your theme's functions.php: ``` {.php} /* letter counter */ add_action( 'admin_head-post.php', 'letter_count_js')); add_action( 'admin_head-post-new.php', 'letter_count_js' )); public function letter_count_js(){ echo ''; } ``` [^1]: [^2]: