Last active
October 31, 2022 17:13
-
-
Save wpscholar/c65523da12007c55962743bbd8eea1d9 to your computer and use it in GitHub Desktop.
An add-on plugin for the "Simple Website Redirect" plugin that prevents redirects from happening on the homepage.
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
<?php | |
/** | |
* Simple Website Redirect - Not Homepage | |
* | |
* @package SimpleWebsiteRedirectNotHomepage | |
* @author Micah Wood | |
* @copyright Copyright 2022 by Micah Wood - All rights reserved. | |
* @license GPL2.0-or-later | |
* | |
* @wordpress-plugin | |
* Plugin Name: Simple Website Redirect - Not Homepage | |
* Plugin URI: https://gist.github.com/wpscholar/c65523da12007c55962743bbd8eea1d9 | |
* Description: An add-on plugin for the "Simple Website Redirect" plugin that prevents redirects from happening on the homepage. | |
* Version: 1.0 | |
* Requires PHP: 5.4 | |
* Requires at least: 4.0 | |
* Author: Micah Wood | |
* Author URI: https://wpscholar.com | |
* Text Domain: simple-website-redirect-not-homepage | |
* Domain Path: /languages | |
* License: GPL V2 or later | |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
add_filter( | |
'simple_website_redirect_should_redirect', | |
function ( $should_redirect, wpscholar\Url $url ) { | |
if ( $url->path === '/' && $url->query === '' ) { | |
$should_redirect = false; | |
} | |
return $should_redirect; | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment