WordPress Tutorials

How to hide specific posts from the homepage on WordPress

Do You want to hide some of your posts from the front page or Blog Page?

I Understand, Sometimes you want to create a “low-profile” addition to your blog.

In other words, want to hide specific posts that don’t belong on the front page, or maybe you don’t want it to show up anywhere else in your blog except when you explicitly link to it.

If you would like to hide particular blog post on your website homepage or blog page. It is quite easy and there are two ways to do it. We will discuss both of them.

1. Use Of Plugin To Hide Specific Posts

WP Hide Post – This plugin excels in giving you full control over the visibility of your a post.

By default, any post you add to your WordPress blog will become the topmost post and will show up immediately on the front page in the first position, and similarly in the category, tags and archive pages.

This plugin allows you to create such “hidden gems”.

In particular, this plugin allows you to control the visibility of a post in various different views:

  • The Front Page (Homepage, depending on your theme, this may not be relevant)
  • The Category Page (listing the posts belonging to a category)
  • The Tag Page (listing the posts tagged with a given tag)
  • The Authors Page (listing the posts belonging to an author)
  • The Archive Pages (listing the posts belonging to time period: month, week, day, etc..)
  • The Search Results
  • Feeds

The posts will disappear from the places you choose them to disappear.

Everywhere else they will show up as regular posts.

In particular, permalinks of the posts still work, and the fun part is it will not affect SEO ranking for that particular post as the post will be on Your Sitemap as well.

This means that the content of your post will be indexed and searchable by search engines.

If you want to hide WordPress page, this plugin also allows you to control the visibility with two options:

  • Hide a page on the front page (homepage) only.
  • Hide a page everywhere in the blog (hiding the page in the search results is optional).

Technically, whenever pages are listed somewhere using the get_pagesfilter, this plugin will kick in and either filter it out or not according to the options you choose.

The same rules apply regarding permalinks and sitemaps as they do for regular posts.

“WP Hide Post” plugin is a great tool in your arsenal for SEO optimization.

It allows you to add plenty of content to your blog, without forcing you to change the nature and presentation of your front page,

for example.

You can now create content that you otherwise would be reluctant to add to your blog because it would show immediately on the front page, or somewhere else where it would not belong.

It’s a must-have feature for any WordPress blog.

2. Code Snippet to Hide the Specific Category Completely

This is different approach to hide posts in your posts. Instead of hiding every single post. You can hide the whole category.

In your theme’s functions.php file just inserts the following code. replacing the category IDs with the ones you want to exclude:

This will work really great if you already have a lot of posts to hide. In your theme’s functions.php file just inserts the following code. replacing the category IDs with the ones you want to exclude:

<?php if (is_front_page() && !is_paged() 
) $posts = query_posts($query_string . '&cat=-33,-66'); ?>

This prevents posts from categories 33 and 66 from appearing in the list of posts. You can change the category ID in above code.

Watch the video below If you don’t know how to check Category Id

Let us know if any issue you are having to hide specific posts blog page.

Show More

Related Articles

Close