How to Hide a Post From Home Page in WordPress

Have you ever sought after to cover a weblog submit out of your WordPress homepage or weblog archive web page?

While you’ll be able to make WordPress posts password safe or personal, in some instances you could merely need to cover the submit out of your homepage whilst nonetheless permitting others to view it if they’ve the direct hyperlink.

In this newsletter, we can display you ways to cover posts from decided on pages in WordPress similar to homepage, class archives, seek effects, and extra.

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

This way is more straightforward, and it is suggested for novices.

First factor you want to do is set up and turn on the WordPress Hide Posts plugin. For extra main points, see our step-by-step information on how to set up a WordPress plugin.

Once the plugin is activated, pass forward and edit the submit you need to cover. You will realize a new ‘Hide Posts’ phase in the precise column of the editor.

Hide posts settings

Clicking on it is going to expose plugin choices. You can cover the submit at the entrance web page and weblog web page, class or tag pages, authors web page, and website seek effects.

Simply choose the choices you favor after which save your submit.

Depending at the choices you decided on, you’ll be able to now consult with the ones pages and that individual submit might not be indexed.

All customers who’ve the direct submit URL (permalink) can nonetheless see it by means of getting into the URL.

While this system is the perfect, it lacks a number of robust choices.

For instance, you can not cover a web page or a customized submit sort like a WooCommerce merchandise. It additionally does now not have an possibility to cover a submit from WordPress RSS feed.

Method 2. Manually Hide WordPress Posts and Pages

This way calls for you to upload code to your WordPress website. If you haven’t performed this sooner than then see our information on how to reproduction and paste code snippets in WordPress.

WordPress makes use of a database question to fetch and show posts in line with the web page a person is viewing. It additionally supplies built-in hooks to adjust the question sooner than operating it.

We will probably be the use of the ones hooks to adjust the WordPress question and conceal the WordPress posts, pages, and customized submit varieties in other sections.

You can upload customized code the use of the code snippets plugin which is more secure and does now not damage your website. Alternatively, you’ll be able to upload the customized code to your theme’s purposes.php record or a site-specific plugin.

You may also want the IDs of the submit or pages that you need to cover. We have a fast instructional on how to in finding a submit ID in WordPress that presentations how to get this data.

Basically, you’ll be able to simply edit a submit or web page to view its ID in your browser’s deal with bar.

Finding a post ID in the address bar

That being mentioned, let’s dive into the code section.

Hide WordPress Posts or Pages from Homepage

The following code makes use of is_home() conditional tag to in finding out if the person is viewing the homepage. If they’re, then it excludes the submit IDs from the question.


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

Don’t omit to substitute the IDs throughout the array with the real IDs of posts or pages that you need to exclude.

Hide WordPress Posts or Pages from RSS Feed

If you need to cover a WordPress submit from the homepage in addition to the WordPress RSS feed, then you’ll be able to merely use the is_feed conditional tag in the code.


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

Now in case you are logged in as an administrator and attempted to consult with your WordPress RSS feed, then you’re going to nonetheless see the posts indexed there. Other customers will be unable to see the excluded posts after they view your RSS feed.

Hide WordPress Post or Page from Site Search

Now, what if you happen to sought after to cover particular posts from WordPress website seek? To do this, you’ll merely want to upload the is_search conditional tag to the code.



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

You can now consult with your web page and seek for the posts you sought after to cover. Even although those posts are public, they are going to now not seem in seek effects.

Post excluded from search results

Hide WordPress Post or Page from Archives

How about hiding particular WordPress posts or pages from archive pages like class, tags, and date archives? To do this, we can use the is_archive() conditional tag.


serve as wpb_exclude_from_archives($question) {
	  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 a ways we now have discovered how to cover a WordPress submit or web page from particular spaces. Now, what about totally hiding a WordPress submit from these kind of spaces directly?

To do this, you’ll be able to mix the entire conditional tags we now have used previous in a unmarried code snippet.



serve as wpb_exclude_from_everywhere($question) {
	  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 cover the given posts from homepage, RSS feed, seek effects, and archive pages.

Controlling Content Visibility in WordPress

You can cover WordPress posts or pages the use of the 2 strategies we described above. Let’s solution one of the maximum continuously requested questions on content material visibility keep watch over choices in WordPress.

Do those strategies completely cover content material?

No, they don’t.

For instance, serps can have already crawled and listed the submit sooner than you’ll be able to cover it. If you need to save you serps, then see our information on how to cover a WordPress web page from Google.

This additionally won’t paintings if a WordPress plugin makes use of a customized question that skips your assessments and divulges the content material you are attempting to cover.

A greater method could be to password offer protection to a submit in order that most effective customers with the password can view it.

You too can create a personal submit which is most effective visual to the directors, editors and authors to your web page.

Can I take advantage of those strategies to create content material for particular customers?

No, those strategies don’t permit you to successfully percentage content material with particular customers. A greater method could be to use a WordPress club plugin.

Membership plugins like MemberPress permit you to create and post limited content material. You will even promote subscription plans to get right of entry to top class content material.

For extra main points, see our information on how to create a WordPress club web page with step-by-step directions.

We hope this newsletter helped you find out how to cover a WordPress submit from the homepage and different spaces of your web page. You might also need to see our information on how to make a WordPress website totally personal.

If you loved this newsletter, then please subscribe to our YouTube Channel for WordPress video tutorials. You too can in finding us on Twitter and Facebook.

Recent Articles

The Best Pinterest Alternatives to Use if You are Bored of Pinterest

Pinterest is a loved social media network among the lover of aesthetics, mostly females tbh. Now, however more and more people are...

Ways you can add links to your Instagram post in 2021

Instagram has many cool features which need no introduction. However, there are a number of features that...

Finance App You should Have on Your iPhone and Android

We live in the age of digitization. When everything is digital, it is no surprise that money has joined the club too....

5 Video Editing Softwares to Try Your Hand at in 2021

Video is the king when it comes to social media. With reels dominating Instagram and Facebook and...

Charge Your Laptop Without a Charger in 5 Ways

Forgetting your laptop charger is a pretty common thing. We all have been there and all of...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here