wordpress agency, wordpress agency for development, enterprise wordpress, wordpress website, wordpress developer, make a website, wordpress sites, wordpress blog, wordpress for dummies, wordpress website development, wordpress website design, wordpress design, wordpress web design, wordpress help, wordpress designer, premium wordpress themes, create a wordpress website, wordpress plugin development, wordpress theme development, build a wordpress website, wordpress website templates, wordpress web, woocommerce plugin, wordpress free website, wp themes, setting up a website, wordpress web development, wordpress homepage, wordpress cms, best wordpress sites, custom wordpress theme, wordpress for beginners, best wordpress websites, using wordpress, wordpress designs, create website using wordpress, wordpress web developer, wordpress website hosting, wordpress website examples, create new website, start a website, wordpress premium, wordpress web hosting, create wordpress, wordpress customization, wordpress plugin developer, create wordpress theme, custom wordpress development, wordpress guide, wordpress programming, wordpress design services, create wordpress blog, wordpress website tutorial, using wordpress to build a website, how to build a wordpress website, wordpress website developer, using wordpress to create a website, custom wordpress design, wordpress website designers, building a website from scratch, online site hosted by wordpress, wordpress website development company, hosted wordpress, i want to create a website, best wordpress, build website using wordpress, woocommerce wordpress, website using wordpress, make a wordpress website, setting up a wordpress site, start a wordpress blog, wordpress web design company, wordpress website development services, buy wordpress themes, custom wordpress, create wordpress site, wordpress web design services, wordpress themes for business, wordpress page, world press website, custom wordpress website, steps to create a website, websites created with wordpress, best way to create a website, wordpress web design for dummies, wordpress website design company, learn wordpress step by step, build wordpress site, building a website for dummies, using wordpress for a website, create a website from scratch, wordpress website themes, website design using wordpress, wordpress business website, best way to build a website, design wordpress theme, wordpress site design, wordpress professional, wordpress blog page, wordpress site development, how to create a website with wordpress, top wordpress sites, make a website from scratch, make a webpage, build your own wordpress website, setting up a wordpress blog, get wordpress, wordpress layouts, building a website, wordpress website design tutorial, wordpress free site, website creation, e commerce website, website design, create wordpress account, wordpress web development services, design a website, wordpress cms tutorial, setting up your own website, create your own website wordpress, website developer, website developers, best premium wordpress themes, wordpress free blog, top wordpress websites, create a blog website, build wordpress theme, webdesign, website design companies, best way to make a website, web agency, web developers, custom wordpress plugin development, web page design, wordpress malware, web design companies, ecommerce website design, designer websites, professional website design, wordpress best themes, wordpress create website free, professional website, custom wordpress website design, wordpress blog examples, wp plugin development, examples of wordpress sites, web development companies, web design agency, wordpress webpage, custom website design, mobile website design, best way to learn wordpress, web development agency, popular wordpress blogs, setting up a wordpress website, ecommerce web design, create your own wordpress theme, custom web design, ecommerce website development, wordpress web design theme, build your own wordpress site, website companies, website design agency, website development company, wordpress for business, web application development, best wordpress designers, custom website, web design tools, professional web design, web creation, design companies, web design studio, web development websites, new wordpress, ecommerce design, how to use wordpress to create a website, website design and development, wordpress website management, wordpress start, make a wordpress site, wordpress membership plugin, new wordpress website, web design and development, make wordpress, custom wordpress site, the best wordpress themes, ecommerce web development, wordpress application development, great wordpress sites, wordpress theme designer, new website design, wordpress step by step, web design portfolio, develop website using wordpress, create professional website, best web design, online wordpress, new wordpress site, wordpress tutorials for beginners, best web design company, create wordpress template, start wordpress website, themes wordpress, world press website design, build your website with wordpress, best wordpress blogs, learn to build a website, wordpress tutorial 2022, woocommerce shop, web design prices, premium wp themes, ecommerce website development company

WordPress Agency for Development | Vipe Studio » WordPress Development » How To Hide a Post From a WordPress Homepage?

How To Hide a Post From a WordPress Homepage?

Reading Time: 3 minutes

There are situations where you just want to hide a homepage rather than take the whole page down. How readers get access to it is by asking you for a direct link to the page. Hiding a homepage on WordPress is possible and that is exactly what this article is about.

First Method: Hiding a post on WordPress can be done using a plugin.

Using Hide Posts plugin from WordPress is the easiest and simplest of all methods. It is highly recommended for beginners and professionals. Download the plugin, install and then activate. After activating, create a new post or edit an already existing one. While editing, there is a ‘Hide Posts’ button or section on the right side of the editor.

The plugin has several options like hide the post on the front page, author’s page, tag pages, category pages and search results. Save every progress done and then depending on the option you choose, visit the pages you effected the changes on. The page won’t come up. The page(s) can only be viewed if you have the URL to that page.

As easy as this method is, it does not do some major task like hiding a post from WordPress RSS feed.

Second Method: Hide WordPress posts and pages manually

If you ever thought yourself to write some pretty looking codes in your past, here you are. The manual method requires a little bit of coding. Based on a page a user is viewing, WordPress uses a database query get and display posts. Modification to the query is also possible via the built-in terminal. With this terminal, we can hide whatever post or page we want to and also select post types in sections. By using the code snippet you can add custom code which is relatively safer. Custom code can be added to a theme’s functions.php or a plugin.

  WordPress Staging Sites from the Ground Up: Getting it Done Manually (Part 2)

In editing a page or post, you will need the IDs of the page. You can edit a post to see its ID in the browser’s address tab.

To hide WordPress pages or posts from homepage

The code below uses is_home() tag to know if the user is seeing the homepage. It excludes the post IDs from the query if they are.

function vipe_exclude_from_home($query) { 
      if ($query→is_home() ) { 
          $query→set('post__not_in', array(1737, 1718)); //add your IDs 
      } 
} 
add_action('pre_get_posts', 'vipe_exclude_from_home'); 

But let’s try one more thing:

To hide WordPress post from site search

You may want to hide a post from WordPress site search. You would add is_search conditional tag to the code

function vipe_exclude_from_search($query) { 
      if ($query→is_search() ) { 
          $query→set('post__not_in', array(1737, 1718)); //add your IDs 
      }
} 

add_action('pre_get_posts', 'vipe_exclude_from_search); 

After writing this code, check your website and see if the post you wanted to hide has hidden.

 

To hide WordPress post from everywhere

There is so much you can hide differently but what if I want to hide it from every corner? This will be achieved by combining the conditional tags

 
function vipe_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 your IDs 
      }
} 

add_action('pre_get_posts', 'vipe_exclude_from_everywhere'); 

This code hides a post from RSS feed, archive pages, homepage and search results.

So with these two methods, we can hide a page or multiple pages.

  How to Use Google Web Stories for Your WordPress Website?

Looking for WordPress Website Development for your Business?

Our professional developers have proven experience in building high-quality business websites that outperform the competition, thanks to our meticulous attention to detail and the implementation of cutting-edge technologies. We will conduct an in-depth business analysis to ensure the website we create for you meets your highest expectations. Your site will have all of the necessary elements to assist you in increasing your ROI and sales.

Contact Us

The content of this website is copyrighted and protected by Creative Commons 4.0.

Tags:

Vipe Team

Author Vipe Team

Our tireless team who creates high-quality WordPress-related content for you 24/7/365.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

We have already created hundreds of profiting websites!

We have already created hundreds of profiting websites!

Subscribe to our newsletter and get our best WordPress tips!

[mc4wp_form id="8747"]