Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save champsupertramp/514557bcbc9db45587e009b0871c94de to your computer and use it in GitHub Desktop.
Save champsupertramp/514557bcbc9db45587e009b0871c94de to your computer and use it in GitHub Desktop.
Ultimate Member - SEO Yoast cannonical URL with Profile or User page URL
<?php
add_filter( 'wpseo_canonical', 'um_custom_user_yoast_canonical' );
function um_custom_user_yoast_canonical() {
if( function_exists('um_is_core_page') ){
if ( um_is_core_page('user') && um_get_requested_user() ) {
um_fetch_user( um_get_requested_user() );
return um_user_profile_url();
um_reset_user();
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment