Title: Post Category Notifications
Last modified: January 13, 2022

---

# Post Category Notifications

 *  Resolved [erubiales](https://wordpress.org/support/users/erubiales/)
 * (@erubiales)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/post-category-notifications/)
 * Is it possible to enable auto-notifications for posts published in a selected
   category?
 * Using custom post types makes it very difficult to display the publications in
   Avada theme widgets.
 * Regards.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [wpdever](https://wordpress.org/support/users/wpdever/)
 * (@wpdever)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/post-category-notifications/#post-15252624)
 * Hi,
 * To create notifications for posts in certain categories only, you can add this
   to your theme’s functions.php file:
 *     ```
       add_filter('wnbell_restrict_post_term','restrict_post_category',10,2);
        function restrict_post_category($allowed, $post_id){
       $categories = array('Some category', 'Another category');
       $post_categories = wp_get_post_categories( $post_id, array('fields' => 'ids') );
       $allowed = false;
       foreach($categories as $category){
       $cat_id = get_cat_ID($category);
       if(!$cat_id) continue;
       if(in_array($cat_id,$post_categories)){
       $allowed=true;
       break;
       }
       }
       return $allowed;
        } 
       ```
   
 * and replace this with your categories:
    $categories = array(‘Some category’, ‘
   Another category’);
 * For the custom post types, I’m not sure what you mean. I can’t test with this
   theme but let me know if there’s something I should fix.
 *  Thread Starter [erubiales](https://wordpress.org/support/users/erubiales/)
 * (@erubiales)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/post-category-notifications/#post-15260096)
 * Thank you very much for your fast support! Regards.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post Category Notifications’ is closed to new replies.

 * ![](https://ps.w.org/wp-notification-bell/assets/icon-256x256.png?rev=2439614)
 * [WP Notification Bell](https://wordpress.org/plugins/wp-notification-bell/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-notification-bell/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-notification-bell/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-notification-bell/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-notification-bell/reviews/)

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)

 * 2 replies
 * 2 participants
 * Last reply from: [erubiales](https://wordpress.org/support/users/erubiales/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/post-category-notifications/#post-15260096)
 * Status: resolved