How To Change The Yoast SEO Description Through The Function’s File

Looking to change the Yoast SEO description through the functions file dynamically? All you may need is to add a filter to wpseo_metadesc.

Changing the Yoast meta decription

To change the meta description of Yoast SEO, you should add a filter to wpseo_metadesc as per below.

function custom_description( $description ) {
     $description = 'New Description';
     return $description;
add_filter( 'wpseo_metadesc', 'custom_description', 10, 1 );