Your blog lists out every article belonging to all categories. However, it takes a lot of time to hide post by post. Removing a whole category proves convenient to hide multiple related posts at a time. Another great example comes to removing Uncategorized cateogy. Every writer has expert knowledge of a specific niche. Some of them just write standard content while others provide premium posts. Not all visitors are authorized to view both types of content. Readers often find articles through the search box.
Removing less important categories offers users a shorter list of results. The question now turns to how you make a category private.
However, removing an entire category sometimes frustrates beginners. In order to exclude a category from displaying on your blog page or homepage, manually take these 2 big steps:. Hover on the title of the desired category 3.
Get its ID number in the link at the bottom of the screen. Click on the functions. Add the following code to the bottom of the file. You can also exclude several categories at a time by adding their category IDs into the brackets in the third line and separating them with commas.
For example:. Place the following code snippet in your functions. Removing a category programmatically requires technical knowledge. You also have to remember every ID whenever removing multiple categories at a time. There are a number of plugins capable of handling this concern. Take the following 4-step guide to get started:. Select your desired category 4.
In the Password Protection column, click on the Protect category to quickly password protect it. Once password protected, all posts under that category become invisible to the general public.
Improve this answer. Community Bot 1. Your function will exclude posts of selected categories from the loop on the main blog listing page, from category listing pages and from archives very well, but not from Recent Posts and not from Recent Comments widgets in sidebar. How to resolve this? OK, thank you! Here is my question: wordpress. Per TheDeadMedic's answer I have revised this to work on all queries: wordpress.
Niels Niels 1 1 gold badge 5 5 silver badges 14 14 bronze badges. I'm against using plugin for minor tasks like this.
Plus you learn a thing or two looking at an actual code : — user Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. If you just want a tool that offers this feature, this plugin is easy to use. There could be a number of reasons why you would want to remove certain categories from the homepage in WordPress.
Customize the appearance of your site and keep your audience engaged. How many categories do you have set up on your website? How do you customize the category list to make it more unique or attractive? Your email address will not be published. This site uses Akismet to reduce spam. Learn how your comment data is processed. Share via: Facebook Twitter LinkedIn. Related Posts.
0コメント