Step by Step Procedure to hide post from home page
Step 1: Identify the Post ID
First you need to get the post ID which you want to hide on home page.
Step 2: Edit Your Function.php file
Open your function.php file and paste the below mention code in it.
Replace the Array "XX" with your Post "ID". and then save it. In my case it is "1044".
Step 3: Its Done !!
Check your home page or blog page, it iw now disappear from home page and blog page. If it is still showing their please let me know in comments.
Step 1: Identify the Post ID
First you need to get the post ID which you want to hide on home page.
Wordpress Post ID |
Step 2: Edit Your Function.php file
Open your function.php file and paste the below mention code in it.
<?php
function wpb_exclude_from_home($query) {
if ($query->is_home() ) {
$query->set('post__not_in', array(xx));
}
}
add_action('pre_get_posts', 'wpb_exclude_from_home');
?>
Replace the Array "XX" with your Post "ID". and then save it. In my case it is "1044".
Wordpress function.php file |
Step 3: Its Done !!
Check your home page or blog page, it iw now disappear from home page and blog page. If it is still showing their please let me know in comments.