So yesterday, when I wrote my first blog post on this site, I found myself having to go back to my post two or three times because I had noticed that I had used the incorrect capitalisation on the word ‘WordPress’. Should be a capital W and P.

So in my warped mind, tonight I decided to write a wee plugin that will auto fix this issue whenever I publish or update a post. It’s probably the most straightforward pluginΒ you could hope to write but I like the exercise as you never know what you might learn on the way.

What I Did

In WordPress there is a FilterΒ calledΒ wp_insert_post_dataΒ this filter basically allows you to intercept the POST data from when the user presses ‘Publish’ or ‘Update’ on the CMS and edit the data in any way you want BEFORE the data is added to the database.

The syntax for running this filter looks like this:

So in my function I have basically done a find and replace and returned the new data for WordPress to add to the database.

The Final Plugin:

Screen-Shot-2015-03-19-at-20.54.39

Download Now