When it comes to drafting and editing posts, one of the things that I often have to refer to is how to properly capitalize certain headings. I’d figure after this long, I’d actually have all of the rules memorized, but apparently that’s not the case (no pun intended :).

Anyway, in order to help with this, I was using a third-party tool for double-checking proper capitalization of post titles and heading elements. But, over time, that became a bit tedious so I created a small plugin to automatically and properly capitalize post titles and the heading elements of post content.

Stretching myself as creatively as possible, I’ve opted to call the plugin Title Capitalization for WordPress.

Title Capitalization for WordPress

As stated in the project’s README:

Properly capitalizes post titles and heading elements in the post content.

Easy enough.

Title Capitalization for WordPress

The plugin works like this:

  • When activated, the plugin will process the post title and post content whenever a post is saved as a draft, published, or updated.
  • The post title and content will be saved to the database replacing whatever was previously written (so changes cannot be rolled back).
  • Note that the plugin does not update previously written posts unless you go back and update them.

Anyway, this is something largely written for myself; however, it’s available on GitHub with the usual README file for how to download and install it. Additionally, the plugin is compatible with Andy Fragen’s GitHub Updater so if you’d like to keep up with updates, then be sure to install it, as well.

Finally (and thanks to open source), this plugin has also been made possible by the work of several other developers.


For more information, check out the GitHub page or download the latest version of the plugin.


Join the conversation! 12 Comments

  1. This is great, I tend to forget the rules too. I wonder how much work would it take to add support for other languages without filling the title case class with a lot of code.

    • Honestly, this would depend on the core library that the plugin depends on (which was initially written by John Gruber).

      I’m not familiar enough with other languages – sadly – to know the rules of capitalization, but if it were possible, then what we could do is something like this:

      • Create a class that represents the capitalization rules for each language
      • At runtime, instantiate the class that corresponds to the current locale (falling back to, say, English as the default)
      • Process the code with that subclass

      Obviously, this would still take a lot of work from people speaking various languages, but the architecture for it should be relatively simple.

  2. WordPress 3.9 running Responsive theme.
    Comment Images
    Deactivate | Edit
    Allow your readers easily to attach an image to their comments on posts and pages.Version 1.13.2 | By Tom McFarlin | Visit plugin site
    I’m having problems. On the browser safari -you can see his name showing up.
    On firefox its a long process to make a comment. name,email, website, comment and of course image.. I wonder if this is the complete code from your plugin or if part is from wordpress already install with the system? Google Chrome, is different and is my preference of the 3 as for as commenting goes. I feel I could just moderate the comment myself. I’m in the process of setting my computer back up (it got to full) and re-importing from time capsule and my imac is in safe mode. Please let me know something and thanks for your answers in advance. I know this is not the topic of this blog.

  3. Which capitalisation rules do you use?

    • The library that I’m using can be found here, but the gist of the rules are listed here.

      The thing is, over time, I’d like to adapt it to be able to easily plug in rules based on the locale of where the plugin is running (or where the plugin is setup to run).

  4. That was exactly what I was looking for!
    Would it not be more interesting to include a menu plugin within wordpress so that each configuring it their own very rules?
    This would save work to establish strict rules for each language … you put up Poderi rules “pre-set” for each language but giving the user the possibility to change them (by the rules of the plugin menu)

    If you need help with the rules or with a translation of the possible menus Portuguese plugin to let me know!

    • Would it not be more interesting to include a menu plugin within wordpress so that each configuring it their own very rules?

      Eventually, I’d love to do something like that.

      Right now, the long term plan is to make the rules more modular so that depending on locale or style, one could easily change out languages so that the plugin adheres to those rules.

      If you need help with the rules or with a translation of the possible menus Portuguese plugin to let me know!

      Always open to that! Once the plugin gets a bit further in development, I’ll keep that in mind (or don’t forget to contact me if I forget to do so first!)

  5. I’m having a little problem, I think, is easily solved … When the title is entirely in uppercase, the rules are not applied. Would not it be ideal to include as a first step (in the method of conversion of titles) simply leaves it entirely in lowercase?

    • You’re correct – if the headings are all in capitalizations, then the rules will not apply.

      What you’ve suggested is a good idea. If you don’t mind, please open an issue on GitHub and I’ll be able to update it in the next release.

  6. Does this work for chinese? Haha… Actually the plugin sounds like it meets my immediate need, hence my arrival here. Will try it out, thanks Tom!!

    • Right now, the plugin needs to be re-written. It’s on my list of things to eventually do but I haven’t had a chance to revisit it in a few versions of WordPress :).

      I don’t speak Chinese or Mandarin so I’d need a contributor to help with that ;).

Leave a Reply