- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
WordPress. How to exclude category from displaying on Blog page
August 31, 2015
This tutorial is going to show you how to exclude category from displaying on Blog page in WordPress.
WordPress. How to exclude category from displaying on Blog page
If you want to exclude category from displaying on Blog page, perform the following steps:
-
Go to your WordPress admin panel, navigate to Appearance -> Editor:
-
Look for custom-function.php file of your theme##### and open it to edit.
-
Add this piece of php code to the file mentioned above and save changes:
function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '-17' ); } } add_action( 'pre_get_posts', 'exclude_category' );
Feel free to check the detailed video tutorial below:
WordPress. How to exclude category from displaying on Blog page