Restricting Post Titles in WordPress

I've been working on a site that required the restriction of post titles from within the CMS. It would have been easy to wrap the title in a substr() but that would have left the client confused as to why half of their title was missing.

I couldn't find anything that would do this so I put together a little plugin to restrict the title via JS. Not infallible and easily circumvented but the purpose was just to solve an issue of usability for the client.

Limit Post Titles Plugin

It's a pretty simple plugin with a single settings page to control which post types to limit and to define the character limit.

Settings Page

It'll then add a little counter to the title field on the selected post types.

Character counter on a page

If the character count of the field exceeds the limit the counter will go red and the publish button completely disabled.

Download

The plugin can be downloaded from the WordPress repository or directly from GitHub.

Download on WordPress.org → View on GitHub →

Work With Us! We're currently accepting new projects at Cocoon. If you have a cool new thing you want us to help with, feel free to drop me a line ✌️


About Stephen Radford

Software Engineer. I take a few photos when I'm not stuck behind a keyboard too.

Leicester, UK http://stephenradford.co.uk

Comments