Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Hide a Post From Home Page in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Have you ever wanted to hide a blog post from your WordPress homepage or blog archive page?

While you can make WordPress posts password protected or private, in some cases you may simply want to hide the post from your homepage while still allowing others to view it if they have the direct link.

In this article, we will show you how to hide posts from selected pages in WordPress such as homepage, category archives, search results, and more.

Hide Posts from Home Page in WordPress

We’ll show you two different methods for hiding posts from the homepage. You can use the quick links below to jump straight to the method you want to use.

Method 1. Hide a WordPress Post from Homepage Using a Plugin

This method is easier, and it is recommended for beginners.

The first thing you need to do is install and activate the WordPress Hide Posts plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Once the plugin is activated, go ahead and edit the post you want to hide. You will notice a new ‘Hide Posts’ section in the right column of the editor.

Hide posts settings

Clicking on it will reveal plugin options. You can hide the post on the front page and blog page, category or tag pages, authors page, and site search results.

Simply select the options you like and then save your post.

Depending on the options you selected, you can now visit those pages and that particular post will not be listed.

All users who have the direct post URL (permalink) can still see it by entering the URL.

While this method is the easiest, it lacks several powerful options.

For example, you cannot hide a page or a custom post type like a WooCommerce products. It also does not have an option to hide a post from WordPress RSS feed.

Method 2. Manually Hide WordPress Posts and Pages

This method requires you to add code to your WordPress site. If you have not done this before then see our guide on how to copy and paste code snippets in WordPress.

WordPress uses a database query to fetch and display posts based on the page a user is viewing. It also provides built-in hooks to modify the query before running it.

We will be using those hooks to modify the WordPress query and hide the WordPress posts, pages, and custom post types in different sections.

You can add custom code using a code snippets plugin which is safer and does not break your site. Alternatively, you can add the custom code to your theme’s functions.php file or a site-specific plugin.

You will also need the IDs of the post or pages that you want to hide. We have a quick tutorial on how to find a post ID in WordPress that shows how to get this information.

Basically, you can just edit a post or page to view its ID in your browser’s address bar.

Finding a post ID in the address bar

That being said, let’s dive into the code part.

Hide WordPress Posts or Pages from Homepage

The following code uses is_home() conditional tag to find out if the user is viewing the homepage. If they are, then it excludes the post IDs from the query.

function wpb_exclude_from_home($query) {
      if ($query->is_home() ) {
          $query->set('post__not_in', array(1737, 1718));
      }
}
add_action('pre_get_posts', 'wpb_exclude_from_home');

Don’t forget to replace the IDs inside the array with the actual IDs of posts or pages that you want to exclude.

Again, we recommend using a code snippets plugin like WPCode to easily and safely add this code in WordPress.

To get started, you’ll need to install and activate the free WPCode plugin. For instructions, see this guide on how to install a WordPress plugin.

Once the plugin is activated, click on the Code Snippets menu item from your WordPress dashboard. Then, click the ‘Add New’ button.

Click the Add New Button to Add Your First Custom Code Snippet in WPCode

Next, find the ‘Add Your Custom Code (New Snippet)’ option and click on the ‘Use snippet’ button underneath it.

Add your new custom code snippet in WPCode

On the ‘Create Custom Snippet’ page, you can start by adding a title for your snippet. This can be anything that helps you remember what the code is for.

Then, simply paste the code from above into the ‘Code Preview’ box and select ‘PHP Snippet’ as the code type from the dropdown menu.

Paste code snippet into WPCode

After that, switch the toggle from ‘Inactive’ to ‘Active’ and click the ‘Save Snippet’ button.

Activate and save your custom code snippet

Next, we’ll show you some additional options for hiding WordPress posts or pages. You can follow the same steps as above to add these code snippets in WordPress using WPCode.

Hide WordPress Posts or Pages from RSS Feed

If you want to hide a WordPress post from the homepage as well as the WordPress RSS feed, then you can simply use the is_feed conditional tag in the code.

function wpb_exclude_from_feed($query) {
      if ($query->is_feed() ) {
          $query->set('post__not_in', array(1737, 1718));
      }
}
add_action('pre_get_posts', 'wpb_exclude_from_feed');

Now if you are logged in as an administrator and tried to visit your WordPress RSS feed, then you will still see the posts listed there. Other users will not be able to see the excluded posts when they view your RSS feed.

Hide WordPress Post or Page from Site Search

Now, what if you wanted to hide specific posts from WordPress site search? To do that, you’ll simply need to add the is_search conditional tag to the code.

function wpb_exclude_from_search($query) {
      if ( $query->is_search() ) {
          $query->set('post__not_in', array(1737, 1718));
      }
}
add_action('pre_get_posts', 'wpb_exclude_from_search');

You can now visit your website and search for the posts you wanted to hide. Even though these posts are public, they will not appear in search results.

Post excluded from search results

Hide WordPress Post or Page from Archives

How about hiding specific WordPress posts or pages from archive pages like category, tags, and date archives? To do that, we will use the is_archive() conditional tag.

function wpb_exclude_from_archives($query) {
      if ( $query->is_archive() ) {
          $query->set('post__not_in', array(1737, 1718));
      }
}
add_action('pre_get_posts', 'wpb_exclude_from_archives');

Hiding WordPress Post or Page from Everywhere

So far we have learned how to hide a WordPress post or page from specific areas. Now, what about completely hiding a WordPress post from all these areas at once?

To do that, you can combine all the conditional tags we have used earlier in a single code snippet.

function wpb_exclude_from_everywhere($query) {
      if ( $query->is_home() || $query->is_feed() ||  $query->is_search() || $query->is_archive() ) {
          $query->set('post__not_in', array(1737, 1718));
      }
}
add_action('pre_get_posts', 'wpb_exclude_from_everywhere');

This code will hide the given posts from homepage, RSS feed, search results, and archive pages.

Controlling Content Visibility in WordPress

You can hide WordPress posts or pages using the two methods we described above. Let’s answer some of the most frequently asked questions about content visibility control options in WordPress.

Do these methods perfectly hide content?

No, they don’t.

For example, search engines may have already crawled and indexed the post before you can hide it. If you want to prevent search engines, then see our guide on how to hide a WordPress page from Google.

This also will not work if a WordPress plugin uses a custom query that skips your checks and reveals the content you are trying to hide.

A better approach would be to password protect a post so that only users with the password can view it.

You can also create a private post which is only visible to the administrators, editors and authors on your website.

Can I use these methods to create content for specific users?

No, these methods do not allow you to efficiently share content with specific users. A better approach would be to use a WordPress membership plugin.

Membership plugins like MemberPress allow you to create and publish restricted content. You can even sell subscription plans to access premium content.

For more details, see our guide on how to create a WordPress membership website with step by step instructions.

We hope this article helped you learn how to hide a WordPress post from the homepage and other areas of your website. You may also want to see our guide on how to make a WordPress site completely private or our expert picks of the best VPN services for WordPress users.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

34 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Jiří Vaněk says

    Thanks for the plugin tip. I personally use the Category Excluder plugin, but it removes the entire category from the homepage, and that doesn’t always work for me. I will try your plugin so that I don’t always have to select the whole category but only an individual article. That suits me much better.

  3. Amit says

    Hiding a post with this plugin, does it prevent search engine from crawling and indexing the post? Does it prevent the post’s google search?? Please let me know.

    • WPBeginner Support says

      No, it would not, this would be for excluding the post from your home page, not preventing it from being crawled.

      Admin

  4. Rakesh says

    Is there any way to hide specific post from only home page latest post section but not from sidebar recent post widget?

  5. Dale says

    This plugin no longer works. I have been searching for an alternative but haven’t found one yet. Would love an update to this post.

    • WPBeginner Support says

      Thank you for letting us know, we will certainly take a look at this plugin and update this article.

      Admin

        • Kelsey says

          I would just use the PHP snippet mentioned above and post it in your child theme functions.php file. That’s what I did to hide my post.

  6. Daniel says

    My only gripe is that the category post count in my category menu is incremented, even though the post can’t be shown this way. . Other than that, it is perfect.

  7. Dada says

    Hi, is google still can index the hidden post? Because i still want people can search my post on google search but not show on frontpage?

  8. campbell says

    Hi, I am wanting to keep my blog posts visible on my blog page but hidden/removed on my homepage. I downloaded the plugin and followed the instructions. When I checked “hide from front page” my blog post was removed from my blog page and not the homepage, so the opposite of what I want. How can I achieve this? Thanks!

  9. ted bergman says

    Thank you for this incredibly valuable site! When I need to know how to do something in Word Press, I first come here. You usually have the best and easiest to understand answer.

  10. Jason says

    The issue with the plugin is that if you want to have a category page show posts, then you have to leave that unchecked and “recent posts” will then pick it up and show up in all your side bars and footers :(

  11. Munna Hossain says

    This is really a great plugin. It works for me. But I don’t know why the authority doesn’t update this plugin. It still working properly.
    Thanks for your excellent artcle.

  12. coated pill says

    Is there another way to hide particular post since this is not working in my end .

    A simple tutorial might help too if I need to alter on some codes on the themes .

    Thanks

  13. Mario von Gollaz says

    The thing is that there is no real alternative to WP Hide Post. Or is there an alternative? Also WP Hide Post seems to be quite outdated (not updated since quite a while).

  14. Shakir Hassan says

    Hi,
    I’ve hide one of my blog posts from my Homepage, but still, it’s showing on Related Post section area below other blog posts.
    What should I do to get rid of it?
    WPBeginner, your answer is needed.
    Thanks.

  15. Scott says

    Another option isn’t too hide it per se but to re-schedule it to publish on a later date. I think that will effectively do the same thing…at least it did on my site just now.

    • Allie Mackin says

      I did what Scott suggested rescheduled the post for a later date. I went through the trouble of downloading and installing this app and it did not work. When I all I had to do is reschedule for a future date. Mission accomplished sans app.

  16. Dawn Cunnane says

    I really needed this to hide one post from the categories menu and it worked like a charm, thank you!

  17. Arevico says

    This is a perfect example of something I would rather have in the WordPress core than in the plugin domain. Normally, I develop my own themes and solve this by using categories. f.e how shows only most recents posts in the category ‘home’ or not in the category ‘invisible’ ,etc. This plugin help a great deal when you don’t develop your own the,e

    • Brian Jackson says

      I agree Arevico. This should definitely be part of WordPress core by now. An example just this week… I run a marketing blog, but I am doing a review on a standing desk. Since it is a little outside of my niche of readers I am publishing it without having it show up on the homepage. I want to rank for it, but don’t want to lose readers.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.