Redirect a post having a “Draft” status. There are usually 3 types of post status offered by WordPress:
- Draft
- Pending Review
- Published
There is a possibility that you have a post in draft and someone tries to access it via URL. You may wish to redirect the user to either the home page or any other page on your website.

In this article, we will see how to redirect (301) posts having a draft status. We will cover both redirections to the home page or any other page.
We will use wp_redirect() function to perform redirection.
1. Redirect a post having a “Draft” status to the home page
Open the single.php
file, or if you are using custom posts then open your_custom_post-single.php
file and copy and paste the following code:
<?php if($post->post_status == 'draft') { wp_redirect( home_url() . "/", 301 ); } ?>
In the above code, we are redirecting the “drafts” posts to the home page.
2. Redirecting post with “Draft” status to the other page
Open single.php
file, or if you are using custom posts then open your_custom_post-single.php
file and copy and paste the following code:
<?php if($post->post_status == 'draft') { wp_redirect( home_url() . "/some-page/", 301 ); } ?>
In the above code, we are redirecting the “drafts” posts to a page having the name “some-page”.
You will notice that we have used 301 redirects. You can learn more about 301 redirects by clicking here.