How To Create Hidden Blog Posts Wordpress
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. 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. 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. function wpb_exclude_from_home($query) { if ($query->is_home() ) { $query->set('post__not_in', array(1737, 1718)); } } add_action('pre_get_posts', 'wpb_exclude_from_home');
How to Hide a WordPress Post From Your Homepage Manually
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.
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.
Source
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.
Originally published Oct 25, 2019 11:59:56 AM, updated September 01 2021
How To Create Hidden Blog Posts Wordpress
Source: https://blog.hubspot.com/website/how-to-hide-a-post-from-home-page-in-wordpress
Posted by: walkerlonsind.blogspot.com
0 Response to "How To Create Hidden Blog Posts Wordpress"
Post a Comment