Dynamic title in WordPress homepage

Actually the above code (reposted below) worked perfectly. Guess it was a cache issue that it did not get reflected. Thanks for your time!

add_filter('wpseo_title', 'filter_keral_wpseo_title');
function filter_keral_wpseo_title($title) {
    if(  is_front_page() ) {
        $recent = get_posts(array(
        'author'=>1,
        'orderby'=>'date',
        'order'=>'desc',
        'numberposts'=>1
        ));
        if( $recent ){
        $title = get_the_title($recent[0]->ID);
        }
    }
    return $title;
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)