Last active
February 11, 2016 11:46
-
-
Save hissy/5283729 to your computer and use it in GitHub Desktop.
#WordPress 特定のカノニカルリダイレクトを拒否する(どちらでもお好みで)
This file contains 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
<?php | |
function my_redirect_canonical($redirect_url, $requested_url){ | |
// kill specific canonical redirect | |
if ( strpos($requested_url, '?page=') ) | |
return $requested_url; | |
return $redirect_url; | |
} | |
add_filter( 'redirect_canonical', 'my_redirect_canonical', 10, 2 ); |
This file contains 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
<?php | |
function kill_canonical_redirect(){ | |
// kill specific canonical redirect | |
if ( is_feed() ) | |
remove_action('template_redirect', 'redirect_canonical'); | |
} | |
add_action( 'wp', 'kill_canonical_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment