How to Hide Category from WordPress Blog Page

In this article, you’ll learn how to hide category from WordPress blog page. Let us help you through it now. 

By default, the WordPress blog shows all posts from all categories. But in some situations, you want to exclude posts from a specific category.

To hide the category from the WordPress blog page, we need to modify the WordPress loop.  We will modify the loop by using the pre_get_posts hook.

Add the following code snippet in your themes functions.php file. Replace category IDs with the category ID want to exclude.

function hide_category_blog( $query ) {
if ( $query->is_home ) {
$query->set( ‘cat’, ‘-7, -43’ );
}
return $query;
}

add_filter( ‘pre_get_posts’, ‘hide_category_blog’ );

You can obtain category id by editing category. You will find the category id in the URL.

How to Hide Category from WordPress Blog Page

 

CONCLUSION

In short, concealing categories from your WordPress blog page can facilitate the easy use of the page and ensure that you can present your content better. To achieve what the article is suggesting, there are factors that one will have to follow; they will enable one or two changes in the categories so that the audience’s attention is shifted to more important things.

There are other factors such as the use of the plugins, the codes, snippets, or assets of the theme of your blog that make it rather flexible for you to present what you envision your blog to be. You should not forget that it is also important to keep the blog tidy, not only because it pleases the eye, but because people tend to read the content and really get interested in it.

Let us consider, keeping in mind the usefulness of occasionally revising the category structure, in the view of the content strategy and the interests of the target audience. In case you choose to do so, reauthenticating the categories later is equally a light load, leaving room for adjustment as your blog progresses. Most importantly, make sure you check how your redesigned pages appear and operate on other devices.

From the above article, I hope you understand how to hide category from WordPress blog page, if not, then you can contact us.

Happy blogging!

Facebook
Twitter
LinkedIn
WhatsApp
Telegram

I design and develop beautiful, creative, ultra-fast loading, and cost-effective websites. I specialize in WordPress website design, blog design and development, E-commerce Website development, Responsive web design, and WordPress support and maintenance services.

Looking for Better Opportunity?

Please feel free to fill out the form below and we will contact you shortly.