tessguefen
3/18/2015 - 2:44 PM

WordPress YOAST -- Add Trailing slash to canonicals on homepage only. Add to functions.php file of theme.

WordPress YOAST -- Add Trailing slash to canonicals on homepage only. Add to functions.php file of theme.

//** Fix Canonicals **//
function wpseo_canonical_home_url_fix( $canonical_url ) {
    if ( is_home() ) {
        return trailingslashit( $canonical_url );
    } else {
        return $canonical_url;
    }
}
add_filter( 'wpseo_canonical', 'wpseo_canonical_home_url_fix' );