cesardpaz
2/27/2020 - 2:42 PM

Reemplazar Titulo title Yoast SEO

function filter_wpseo_title($title) {
    if(is_tax('episodes')){
        $term_id      = get_queried_object_id();
        $term         = get_term_by('id', $term_id, 'episodes');
        $season       = get_term_meta( $term_id, 'season_number', true );
        $episode      = get_term_meta( $term_id, 'episode_number', true );
        $serie_id  = get_term_meta( $term_id, 'tr_id_post', true );
        $name_episode = get_term_meta( $term_id, 'name', true );
        if(!$name_episode){
            $name_episode = $term->name;
        }
        $title = get_the_title($serie_id) . ' Temporada '.$season.' Capitulo '.$episode.' Online Latino - Series Metro';
    }
    return $title;
}

add_filter('wpseo_title', 'filter_wpseo_title');