I have a plugin with an option to use regular expression and find and replace the title post. I need to convert lots of titles with uppercase and lowcase letters to title case, but I have no idea about regex and all comments I read on this forum not work for me, for example:

\([^ ]*\) \(.*\)
\U\1\E \2




Anyone can help me please? Thanks in advance


You could use the PHP function ucwords().

See: http://php.net/manual/en/function.ucwords.php


$foo = 'hello world!';
$foo = ucwords($foo); // Hello World!
| improve this answer | |
  • Thanks Liam. I also found other php codes to change it, but I prefer to use the plugin regex because the title post is linked to various custom fields and does not apply the changes. In addition the changes made with regex will be permanent, with php are undone if I remove the code. – PhineasD Jun 8 '18 at 9:47
  • So from my understanding you want to make all titles title case? @PhineasD – Liam Stewart Jun 8 '18 at 11:50
  • Yes, the plugin take products from other stores and create a new post in my site, but some titles in origin are in uppercase or lowecase letters and I need to convert it in tittlecase via regex with the same plugin. – PhineasD Jun 8 '18 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.