I have a static default wordpress home page. As you know if you have a homepage on wordpress you can not set a permalink through the admin options, you can only set permalinks for non homepages. Does anyone know of a way that I can set a permalink for my homepage? So that when I visit my site at example, it automatically turns to example/examplelink when the site loads?
Thank you!!
I have a static default wordpress home page. As you know if you have a homepage on wordpress you can not set a permalink through the admin options, you can only set permalinks for non homepages. Does anyone know of a way that I can set a permalink for my homepage? So that when I visit my site at example, it automatically turns to example/examplelink when the site loads?
Thank you!!
Share Improve this question asked Apr 3, 2014 at 21:40 user49894user49894 311 gold badge1 silver badge2 bronze badges2 Answers
Reset to default 3I would set another page as the home page, add a custom template for the home page and put this in it:
<?php wp_redirect( get_permalink( $id ), 301 ); exit; ?>
If you dont want to set the id manually you can do:
1) create a template page-template-homepage-redirect.php in your theme
<?php
/*
Template Name: homepage redirect
*/
wp_redirect( get_permalink( wp_get_post_parent_id( $post_ID ) ), 301 );
exit;
?>
2) create an empty page and use this newly created template
3) Go to settings - Reading and set this new page to static homepage
4) change the slug/permalink of the original homepage to what you'd like to see
5) go back to pages and make sure you set the original homepage you want to redirect to is the parent of the "homepage redirect" page