Last active
February 8, 2022 11:24
-
-
Save pattihis/e8ca1618d273e4f8a233324117aa967a to your computer and use it in GitHub Desktop.
Wordpress - Redirect home page to Shop
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 | |
// Put this in functions.php | |
add_action( 'template_redirect', function() { | |
if( is_home() or is_front_page() ) { | |
$url = esc_url(home_url( '/shop/')); | |
wp_redirect($url); | |
exit(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment