This is a short but detailed guide for how you can redirect WordPress page to another page or website without using plugin.

I’m not really a fan of loading a WordPress site with plugins (probably because I’m a developer). So I’m going to show you how you can redirect to another WordPress page or website without installing another plugin. Watch the video above or keep reading.

What you need to do before you can redirect WordPress page to another

The things you need to do and get ready are;

  1. Child theme or Code snippet plugin
  2. Page ID – ID of the page you are redirecting from
  3. LINK you want to redirect to.

If you do not have a child theme and ready to create one, see the guide below.

How to create a child theme, if you don’t already have one

I recommend you use a plugin to create the child theme version of your theme if you do not know how to code in PHP.

When you are done creating the child theme, deactivate and delete the plugin you used, then activate the Child theme. Use this plugin by Catch Plugins. Download, Install and activate.

How to add codes to the functions.php of WordPress site if you don’t use child theme

To add code to the Functions.php of your WordPress website when you use a Child theme,

  1. Go to Appearance
  2. Click on Theme Editor
  3. Select the Child theme
  4. Click on the functions.php file of the child theme
  5. Then add your code.

How to get WordPress page IDs

To get your WordPress page ID, follow the steps below.

Step #1. Go to your WordPress Pages and edit the page you want to redirect from to get the page ID

Get WordPress Page ID
Click on the Edit link

Step #2. In the browser tab of the page, you will see some numbers, immediately after /post.php?post== . Copy the number or take note of the number, that is your page ID. See the video below.

RECOMMENDED: Beginner to Advanced Website Design Course

Code to redirect page to another page on WordPress

You’ll need a template redirect function in your functions.php file. It contains the wp_redirect callback that wraps the URL you are redirecting to.

See the code below and follow the steps listed afterwards

//TEMPLATE REDIRECT 

function redirect_to_page() {
  if(is_page('PAGE ID HERE')) {
    wp_redirect(site_url('URL-HERE'));
    exit();
  }
}
add_action('template_redirect', 'redirect_to_page');

Step #1. Copy and paste the code above into your functions.php file or the code snippet plugin. Before doing this, be sure you have backed up your website. CLICK HERE TO COPY THE CODE FROM MY GITHUB.

Step #2. Copy the ID of the page you are redirecting from and paste it into the page ID part. Replace PAGE ID HERE with the actual page ID. Like this: if(is_page(’12’))

Step #3. Replace URL-HERE with the URL you want to redirect to on your website.

Step #4. Save your changes and test the redirection

Viola! It is that simple.

WordPress 404 page redirection!

If you want to redirect the 404 page to your home page, change the if statement to;

if(is_404()){
wp_redirect(home_url());
exit();
}

Wrapping up How To Redirect WordPress Page to Another Page Without Plugin

If you wish to redirect your WordPress page to another page or redirect your visitor to a special page, follow the steps highlighted above. It is simple and straightforward. You do not need a plugin to perform WordPress redirect anymore.