Capitalise Yoast SEO meta titles

Trying to capitalise your meta title using Yoast SEO? All you may need is to filter the output and call ucwords() in your WordPress theme’s functions.php file.

Filtering Yoast SEO meta title to capitalise all first letters

To capitalise your Yoast SEO meta title, simply add the function below to your WordPress theme’s functions.php file.

function capital_meta_title( $title ) {
     $title = ucwords( $title );
     return $title;
}

add_filter( 'wpseo_title', 'capital_meta_title' );

Note, you can use an if statement using is_singular( ‘post-type’ ) around the change of $title, if you’d need to filter this for specific post types.