Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save champsupertramp/6369d17a7dbae02b710c58aef5312c5f to your computer and use it in GitHub Desktop.
Save champsupertramp/6369d17a7dbae02b710c58aef5312c5f to your computer and use it in GitHub Desktop.
Ultimate Member - Profile URL compatibility with Social Sharing plugins, Sociaholic
function um_091323_profile_page_link( $permalink, $post_id, $leavename ){
if ( ! class_exists( 'UM' ) || did_action( 'um_profile_header' ) || ! doing_action( 'wp_head' ) ) {
return $permalink;
}
if( $post_id === UM()->config()->permalinks['user'] ) {
$profile_page_slug = get_post_field( 'post_name', UM()->config()->permalinks['user'] );
$arr = explode('/', home_url( $profile_page_slug . '/' . get_query_var( 'um_user' ) ) );
$permalink = implode('/', array_unique( $arr ) );
}
return $permalink;
}
add_filter( 'page_link', 'um_091323_profile_page_link' , 1 , 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment