Created
August 19, 2020 16:44
-
-
Save bacoords/0800cf5d5d3ef04f3a28254f5b5aca6d to your computer and use it in GitHub Desktop.
c3 yoast canonical fix
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
/** | |
* Removes any test urls from Yoast links. | |
* | |
* @param [type] $link | |
* @return void | |
*/ | |
function c3_fix_yoast_canonical_items( $link ) { | |
return str_replace( | |
array( | |
'c3dti.ai', | |
'live-c3dti.pantheonsite.io' // add any other weird URLs that might show up | |
), | |
'c3.ai/dti', | |
$link | |
); | |
} | |
add_filter( 'wpseo_canonical', 'c3_fix_yoast_canonical_items' ); | |
add_filter( 'wpseo_next_rel_link', 'c3_fix_yoast_canonical_items' ); | |
add_filter( 'wpseo_prev_rel_link', 'c3_fix_yoast_canonical_items' ); | |
add_filter( 'wpseo_opengraph_url', 'c3_fix_yoast_canonical_items' ); | |
add_filter( 'wpseo_opengraph_image', 'c3_fix_yoast_canonical_items' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment