How to Hide Posts on Your WordPress Homepage

How to Hide Posts on Your WordPress Homepage


Most WordPress themes are set up so that your latest blog posts appear on the front page of your site. Or, if you have a static homepage, your newest entries appear on a dedicated page. Regardless of how these posts are displayed – in a list, in a tiled view, or what have you – one thing remains the same: the newest posts appear first.

But what if you don’t want your newest blog post to have such a prominent position? Believe it or not, this is actually a fairly common desire from bloggers in every industry. Let’s take some time now to explore some reasons why bloggers want to hide posts in the first place and how to accomplish this task quickly and easily.

Why Hide Posts?

There are a number of reasons why someone would want to hide a post from his or her homepage. For starters, your blog might offer a variety of types of posts from brief news pieces to more in-depth tutorials. The latter make for more appealing posts to appear on a homepage because they are always valuable and not time-sensitive. Plus, if you don’t update your blog super frequently, emphasizing your high value content over news makes your site more relevant on a consistent basis.

Maybe you’ve recently written a post on a controversial topic and don’t want that to be the first thing your visitors see. This is understandable as you wouldn’t want to detract from other, perhaps more relevant, posts. Or maybe you only want to feature posts written by you and not guest bloggers. Or maybe you only want posts from a certain category to appear. The reasons are diverse. What’s important is you can make this simple change pretty painlessly. And you have a couple of options to get it done.

Consider Creating Pages

This requires some planning ahead of time but it’s by far the simplest method to prevent certain posts from appearing on your blog’s homepage – don’t make it a post at all.

Instead, create a new page and post your content there. You can then select where you want this page to appear. You can opt to not have a link on the homepage to this page if you’d like by modifying your menus. Just don’t list the page in the menu as a link and all should be fine. Quick and painless.

Again, this only works if the content in question hasn’t been created yet and you don’t anticipate needing to do this very often. Still, it’s an easy fix.

Use WP Hide Post Plugin

WordPress Hide Posts

The easiest way to exclude posts from the homepage is of course using a plugin (if your homepage is setup to display latest posts). One free option is the WP Hide Post plugin. With this installed you can hide posts (from any post types) from select pages. The plugin is simple and straightforward.

Once installed, you’re provided with a number of options in terms of post visibility right from within the post editor:

WP Hide Post Visibility

You can opt to remove the post from your site’s homepage. You can also remove it from applicable category pages, tag pages and archive pages. You can even select the option to prevent a specific post from appearing in site-wide search results as well as on dedicated author pages. It’s up to you.

You can hide the post in question in all of these ways or just from the homepage. In every other place you don’t select, the post will appear as normal with normal linking structure and everything. That is, it will still have a standard permalink and will be included in the sitemap. This means it’s still searchable via search engines and will appear in those results but it won’t appear at the top of your site. This can also be helpful when you’re creating exclusive content for your readers and you plan on only providing access to it by means of a direct link.

WP Hide Post Settings

As a side note, this plugin can be used to hide posts on any of your custom post types as well. You just have to enable WP Hide Post’s visibility settings under Settings > Hide Posts in the main WordPress menu.

Hiding Posts from RSS Feeds

WP Hide Post can be used to hide posts from showing up as published in your RSS feed as well.

Again, you may wish to do this if your intent is to create posts that act as resources that don’t fit in with your blog’s main style or focus (but you’d still like to rank for in terms of SEO) or if you write posts on occasion that are off-topic and don’t want available to readers as the first thing they see when visiting your site.

To do this, all you have to do is check the box that says “Hide Feeds” on the righthand side of the post editor once the plugin is installed.

Manually Hiding Categories

If you want to hide an entire category from your homepage, you can do this using the WP Hide Post plugin discussed above or you can manually add a bit of code into your child theme functions.php file or via the popular Code Snippets plugin.

Basically, you create a dedicated category for the posts you want to hide, jot down the category ID (you can edit a category and look at the URL to locate the ID), then paste the following bit of code at the end of the file right before “?>” and replace the “xx” with the category ID:

function myprefix_exclude_category($query) {
if ( ! is_admin() && $query->is_main_query() && $query->is_home() ) {
$query->set( ‘cat’, ‘-xx’ );
return $query;
add_filter( ‘pre_get_posts’, ‘myprefix_exclude_category’ );

This bit of code will prevent your chosen category from showing up on your site’s homepage, which can be useful if you plan on offering multiple channels of content on a regular basis and don’t want one of them mixed up with your site’s main content.

With the ability to hide certain posts from your WordPress site’s homepage in your developer’s tool belt, you gain the freedom to create more of the posts you want to make without cluttering up your site. You no longer have to fear making a commentary on a hot subject or creating more content with SEO in mind, since your homepage will remain exactly as you want it to.

Do you hide certain posts from your site’s homepage? If so, why? Also, what tools do you use to accomplish this? We’d love to hear your feedback.


Source link

Leave a Comment

Your email address will not be published.