Steps
-
Add the PHP code to your theme’s
functions.phpfile or a PHP snippets plugin. -
Save and activate the snippet.
-
Open any single blog post on your website.
-
The displayed post title will use title case.
/**
* Convert post titles to title case
*/
function custom_convert_post_title_to_title_case( $title, $post_id ) {
if ( is_admin() || ! is_singular( 'post' ) ) {
return $title;
}
return ucwords( strtolower( $title ) );
}
add_filter( 'the_title', 'custom_convert_post_title_to_title_case', 10, 2 );
Tested on
WordPress 6.8
Reported by the author on November 23, 2026. WPFolks has not verified this.
Not tested against WordPress 7.1.5. It may still work.
