Home › Forums › Support › Remove category from blog page This topic has 7 replies, 2 voices, and was last updated 3 years, 11 months ago by Leo. Viewing 8 posts - 1 through 8 (of 8 total) Author Posts May 11, 2020 at 12:21 pm #1279671 Nimie I would like to keep one category from displaying on the blog page. I tried this: .category-uncategorized .entry-meta { display:none; } and this function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-1’ ); } } add_action( ‘pre_get_posts’, ‘exclude_category’ ); May 11, 2020 at 6:26 pm #1280055 LeoStaff Customer Support Hi there, Just to make sure, you are trying to remove a certain category from the posts loop? If so this is the code you’d need: https://docs.generatepress.com/article/exclude-categories-from-posts-page/ Can you make sure that the category ID is correct? May 11, 2020 at 6:37 pm #1280066 Nimie I tried it and checked the category id. Still not working. Could there be a conflict? May 11, 2020 at 6:40 pm #1280067 LeoStaff Customer Support How are you adding that code? One of these methods? Adding PHP: https://docs.generatepress.com/article/adding-php/ May 11, 2020 at 6:40 pm #1280068 Nimie To the child theme functions php May 11, 2020 at 6:43 pm #1280072 LeoStaff Customer Support I just tested the code in Code Snippets and it worked for me. Can you give that a shot first? May 11, 2020 at 6:52 pm #1280085 Nimie Not working. I have used it on other sites with no problem. All cache is deactivated. May 11, 2020 at 7:48 pm #1280113 LeoStaff Customer Support I have used it on other sites with no problem. Then it must be something specific to this site. Do you another function that might be conflicting? You might have to spend a little more time trying to debug this as we know that the code works. Author Posts Viewing 8 posts - 1 through 8 (of 8 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In