Advanced Category Excluder WP PLUGIN
How to EXCLUDE CATEGORIES WHILE DISPLAY in WordPress? – PLUGIN
If you need to exclude any particular category from the WordPress blog page and sidebar, you can use some of the best category excluder plugins which can help you without knowing a single line of code.
And if you do not wish to install a third party plugin then all you need to do is follow this easy php code step by step , and by modifying a file you will have the WordPress categories you want excluded. This tutorial also includes the sample code and was written for beginners without any coding experience.
PHP code to Exclude categories from Display on Blog
Find the Category ID from wordpress dashboard. If you cant find the category ID, check tutorial here.
Include this php code in functions.php or custom-function.php as used in your website theme.
Remember to change category no as shown in php example with your own category number
function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '-6' ); } } add_action( 'pre_get_posts', 'exclude_category' );
To exclude multiple categories
$query->set( 'cat', '-6,-7' );
This shall Exclude category ID 6 and 7 from display on blog.
[wbcr_html_snippet id=”4340″]
[wbcr_html_snippet id=”4346″]