Skip to content

Instantly share code, notes, and snippets.

@atwellpub
Created August 6, 2014 21:01
Show Gist options
  • Save atwellpub/50190eb9f52c42faa982 to your computer and use it in GitHub Desktop.
Save atwellpub/50190eb9f52c42faa982 to your computer and use it in GitHub Desktop.
Fix for 301 redirect - Removes redirect_canonical for homepage only
<?php
/**
* Fix for 301 redirect - Removes redirect_canonical for homepage only
* @author Hudson Atwell (Inbound Now)
*
*/
function inbound_redirect_canonical($redirect_url, $requested_url) {
if ( is_front_page()) {
return $requested_url;
} else {
return $redirect_url;
}
}
add_filter('redirect_canonical', 'inbound_redirect_canonical', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment