So I am a huge WordPress fan and I tend to modify my sites with massive custom code and pimp them out. One thing I have noticed is there was not a ton of information out there about capitalizing categories in WordPress. My guess is that most people will do that anyways as they create categories, but for those of us you love to syndicate content and allow categories to be populated automatically this can cause lowercase categories to be produced.
Since I am a huge php/mysql fan I love to create scripts that to things for me….automation is a better description of this, and that I am lazy too so I know for my scripts to do things for me.
So here is how you do it
First you are going to want to place the script somewhere on your web server. Most likely in the root of your directory. If you have no idea what I am talking about then you are going to want to read about FTP and how to upload files to your server manually.
In the root of your web server create a folder called “includes” (technically any name is find, just don’t forget it)
Now place this script in the includes folder and call it “capitalize_categories.php”
Replace $host. $usr, $pwd and $db with the proper credentials from your hosting provider.
Once you have done all this you are all set. Then you can simply go to the url that contains this file and it will run it for you
Remember: if you changed the name of the folder and/or script then you will want to change the url to match that.
How to automate this
Now that you have the script, let’s make this even easier and have it run automatically.
In order to do this you are going to want to setup a cron job with your hosting provider. Again if you have no idea what I am talking about then read this
I would set the script to run once a day or whatever you feel is a safe amount of time to do it. Since I syndicate 20+ articles a day I tend to run mine twice a day. You can do whatever you like.
Hope this helps and leave a comment below if you need some help 🙂