Title: custom post types error
Last modified: August 21, 2016

---

# custom post types error

 *  Resolved [kentopolis](https://wordpress.org/support/users/kentopolis/)
 * (@kentopolis)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-error/)
 *     ```
       function my_post_types($types) {
           $types[] = 'portfolio';
           return $types;
       }
   
       add_filter('s2_post_types', 'portfolio');
       ```
   
 * I’m getting this error after putting the above code into my functions.php:
 * Subscribe2 will send email notifications for the following custom post types:
   
   Warning: Invalid argument supplied for foreach() in /home/lovealot/public_html/
   wp-content/plugins/subscribe2/admin/settings.php on line 222
 * [https://wordpress.org/plugins/subscribe2/](https://wordpress.org/plugins/subscribe2/)

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

 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-error/#post-4600880)
 * [@kentopolis](https://wordpress.org/support/users/kentopolis/),
 * The add_filter line is incorrect, the second parameter needs to be the function
   name, not the name of the post type. So, in your case you need that line to be:
   `
   add_filter('s2_post_types', 'my_post_types');`
 *  Thread Starter [kentopolis](https://wordpress.org/support/users/kentopolis/)
 * (@kentopolis)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-error/#post-4600894)
 * Worked great! Thanks!

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

The topic ‘custom post types error’ is closed to new replies.

 * ![](https://ps.w.org/subscribe2/assets/icon-256x256.png?rev=2318630)
 * [Subscribe2 - Form, Email Subscribers & Newsletters](https://wordpress.org/plugins/subscribe2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/subscribe2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/subscribe2/)
 * [Active Topics](https://wordpress.org/support/plugin/subscribe2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/subscribe2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/subscribe2/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [kentopolis](https://wordpress.org/support/users/kentopolis/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/custom-post-types-error/#post-4600894)
 * Status: resolved