3

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.com, it automatically turns to example.com/examplelink when the site loads?

Thank you!!

2

I 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; ?>
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.