Вы можете добавить свою переменную в Yoast
function get_seo_city() {
$city = get_post_meta( get_the_ID(), '_city', true );
if ( ! $city ) {
$string = 'Город по умолчанию';
}
return $string;
}
// Define the action for register yoast_variable replacments.
function register_custom_yoast_variables() {
wpseo_register_var_replacement( '%%City%%', 'get_seo_city', 'advanced', __( 'Some instead title text', 'wpgen' ) );
}
// Add action.
add_action( 'wpseo_register_extra_replacements', 'register_custom_yoast_variables' );
По склонению городов в писал здесь
https://qna.habr.com/q/1130066#answer_2138126