HOWTO: Make WordPress Titles Title Case

HOWTO: Make WordPress Titles Title Case

Ever need to make sure all your titles showed up with using “Title Case” and not just by using CSS? By adding the following to your functions.php file in your theme – you can ensure the post title will have the case you want:

/**
 * Custom Title Case for the_title()
 * @returns $content (title with title case)
 */ 
add_filter( 'the_title', 'sdac_use_title_case' );
add_filter( 'wp_title', 'sdac_use_title_case' );
function sdac_use_title_case( $content ) {
	$content = ucwords( $content );
	return $content;
}

Leave a Reply

Your email address will not be published.
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.