Menu & Search
How to Exclude a Category from Blog Page in WordPress

How to Exclude a Category from Blog Page in WordPress

This is a guide on how to exclude a blog category from a blog page in WordPress. I hide my Web Blog posts from the Tech Blog area, so this is a useful one to note down.

First we need to get the Category tag_ID, which can be gained by hovering over the category link as shown.

WordPress Category Tag_ID

Next up, we need to insert some code at the of our functions.php file.

Theme Functions.php

This can be done via Appearance > Theme Editor as above, but I wouldn’t recommend it. When I first started out this used to work for me, but one day that failed…

I had to use FTP to view the files, to then notice that the functions.php file was empty! I restored the file using the one I had from the original download of my theme. The front-end to my website was unavailable for about 2 hours that night.

For this post, I’ve tested a quick code update using the WordPress Theme Editor again to see what would happen. When I clicked to update there was an endless loading symbol.

Endless Load Update Functions.php

Followed by…

Functions.php Update Error

When I refreshed the page I could see that my code update had not been saved.

I think that confirms it – We should always use an FTP application like FileZilla to update the /public_html/wp-includes/functions.php file.