How to Hide a Post From Your Home Page in WordPress

Anna Fitzgerald
Anna Fitzgerald



Most WordPress themes will show the latest posts on your home page by default, but there are a number of reasons you might want to hide certain posts. 

User hiding a Post From the Home Page of WordPress site

Maybe you just wrote an article about a controversial topic and would prefer it not be the first thing visitors see. Maybe you’d rather showcase your most popular content rather than your most recent content. Or maybe you want to hide posts from guest bloggers to feature your own. 

Whatever the reason, you can hide a post on the homepage of your WordPress site in a few easy steps. Let’s look at how you can do so manually or with a plugin. 

Grow Your Business With HubSpot's Tools for WordPress Websites

How to Hide a WordPress Post From Your Homepage Manually

You can add custom code to your theme’s functions.php file to hide a post from your homepage.

First, you’ll need the ID of the posts or pages you want to exclude from the homepage. To find it, click Posts > All Posts and then hover your mouse over the title of the desired post. The post edit URL will appear at the bottom left-hand corner of your screen. The number that comes between “post=” and “&action” is its ID.

Once you have the ID, copy and paste the following code at the end of your theme’s functions.php file right before “?>”. Don’t forget to replace the IDs inside the array (1737 and 1718 in the snippet below) with the IDs of the posts that you want to exclude.



   function wpb_exclude_from_home($query) {

      if ($query->is_home() ) {

          $query->set('post__not_in', array(1737,




add_action('pre_get_posts', 'wpb_exclude_from_home');

For each new post you want to hide from the homepage, you just have to add its ID to the array. 

How to Hide a WordPress Post From Your Homepage Using a Plugin

If you’re a beginner, then you may want to use a plugin to avoid coding altogether. With the WP Hide Post plugin, you can control whether a post appears on your home page with one mouse click.

After installing and activating the plugin, edit the post you want to hide. There will be a new “Hide Posts” section in the right column of the editor. There you can check the box labeled “hide on frontpage” and save your changes. 

Hide posts from homepage in WordPress in the “Hide Posts” section in the right column of the editor using the WP Hide Post plugin


Once you select this box, the post will be hidden on your homepage but visitors can still find it in other parts of your site. Easy, right?

Whichever method you choose, you can quickly and easily hide a post from the homepage of your WordPress site. This will help ensure that you control the visitor experience on your site from the very first touchpoint.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Related Articles

Capture, organize, and engage web visitors with free forms, live chat, CRM, analytics, and more.