Title: Custom Post Types!
Last modified: August 22, 2016

---

# Custom Post Types!

 *  [cmuld3r](https://wordpress.org/support/users/cmuld3r/)
 * (@cmuld3r)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-184/)
 * Here’s how a developer I work with was able to get the email notifications working
   with a custom post type we created. Will similar functionality for custom post
   types be included in a plugin update? Or should this be submitted on github?
 *     ```
       Line 77 ($category = get_the_category( $post_id );) in db_notification.php was commented out and replaced with $category = get_the_terms( $post_id, ‘category’ );. The get_the_category function does not work with CPT’s and get_the_terms is universal.
           CPT args included the following: ‘taxonomies’ => array('post_tag', 'category')
           Since the plugin only works when a category is assigned, the taxonomy 'category' was added to the CPT blog. Posts have a default category of ‘unassigned’ which is why it works with the plugin so I added an action for when posts are saved to add the category ‘unassigned’ if a category isn't assigned.
   
       add_action( 'save_post', 'set_default_category' ); function set_default_category( $post_id ) {
        // Get the terms
       $terms = wp_get_post_terms( $post_id, ‘category'); 
   
        // Only set default
       if no terms are set yet if (!$terms) {
        // Assign the default category $taxonomy = ‘category';
        wp_set_object_terms( $post_id, 1, $taxonomy );
        }
        }
       ```
   
 * Thank you!
 * [https://wordpress.org/plugins/email-subscribers/](https://wordpress.org/plugins/email-subscribers/)

The topic ‘Custom Post Types!’ is closed to new replies.

 * ![](https://ps.w.org/email-subscribers/assets/icon-256x256.png?rev=2274172)
 * [Email Subscribers & Newsletters - Email Marketing, Post Notifications & Newsletter Plugin for WordPress](https://wordpress.org/plugins/email-subscribers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-subscribers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-subscribers/)
 * [Active Topics](https://wordpress.org/support/plugin/email-subscribers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-subscribers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-subscribers/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [cmuld3r](https://wordpress.org/support/users/cmuld3r/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-184/)
 * Status: not resolved