Skip to content

Instantly share code, notes, and snippets.

@mo3aser
Last active June 16, 2020 18:39
Show Gist options
  • Save mo3aser/4f6d9a7ddfc446474f4b1bc189397b60 to your computer and use it in GitHub Desktop.
Save mo3aser/4f6d9a7ddfc446474f4b1bc189397b60 to your computer and use it in GitHub Desktop.
infinite redirect on static front page WordPress
<?php
/**
* Plugin Name: Fix infinite redirect on static front page
* Description: Use this simple plugin to Fix infinite redirect on static front page with some WordPress versions
* Plugin URI: https://tielabs.com/
* Author: TieLabs
* Author URI: https://tielabs.com
* Version: 0.1.0
* License: GPLv2 or later
*/
// Thanks to andrewtaylor-1
// https://wordpress.org/support/topic/45-causes-infinite-redirect-on-static-front-page/
function tie_disable_front_page_redirect_madness($redirect_url) {
if( is_front_page() ) {
$redirect_url = false;
}
return $redirect_url;
}
add_filter( 'redirect_canonical', 'tie_disable_front_page_redirect_madness' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment