I am helping my father with his WordPress website.
It has over 1,700 posts with TITLES IN UPPERCASE.
We’d like to change these to “Title Case” in the database (possibly using this PHP script).
The WordPress “To Title Case” plug-in changes the case at the template level – we’d like to change it at the database level.
What would be the best way to apply the script to all titles in the WordPress database?
I could write some code from scratch but I’m guessing there’s existing code/methods out there that can apply a function/method across all titles.
Updating the posts
Converting a string to “Title Case”
And, while not pertinent to WP, for the sake of completeness:
Obviously, both lists of words could be expanded – the lower-case list especially by more prepositions, the acronyms by those that are used often on the current site.
The WP-specific part is only the upper code block though, anyhow.
You could change the post title when it is viewed:
This is just an idea, based on this answer. Not tested.
A quick “solution” would be via CSS using text-transform.
However, it would be best if you could change the capitalization on the database since this is a matter of styles, not content 🙂 If you want titles in uppercase, do so through CSS or you’ll have this kind of problem!
This works on an individual title by title reference basis
strtolower turns the title into lowercase.
Then the ucwords makes it proper case
I created a Open Source, Free (no-Pro) plugin that offers exceptions to the rules and other things. The reason I made this was to use on Imports and situations like yours. It changes the Title in the Admin section and in the database, meaning it will work with all themes that are not using a text-transformation on the title. It will do Upper, lower and mixed. It doesn’t currently do sentence case. Please see my ProperProgramming link to see screenshots of how it works. Super easy and you can do it in chunks. The plugin also has configurable exceptions for lower and UPPER case words. So it will do Acronyms.
https://properprogramming.com/tools/wp-change-titles-case/
Or directly on WordPress
https://wordpress.org/plugins/change-titles-case/