Created
February 17, 2022 07:24
-
-
Save AngeliMae/2a9b631a67827762035e86d4a4631d78 to your computer and use it in GitHub Desktop.
RankMath - Allow changing of the canonical URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Allow changing of the canonical URL. | |
| * | |
| * @param | |
| string $canonical The canonical URL. | |
| */ | |
| add_filter( 'rank_math/frontend/canonical', function( $canonical ) { | |
| if( function_exists('um_is_core_page') ){ | |
| if ( um_is_core_page('user') ) { | |
| return um_user_profile_url( um_get_requested_user() ); | |
| } | |
| } | |
| return $canonical; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment