• Resolved joshuaiz

    (@joshuaiz)


    Getting the following error in the Subscribe2 settings page:

    Subscribe2 will send email notifications for the following custom post types:
    Warning: ucwords() expects parameter 1 to be string, array given in …/wp-content/plugins/subscribe2/admin/settings.php on line 219

    In my functions.php I have added my custom post types using the following function:

    // Adds CPT to Subscribe2
    function my_post_types($types) {
        $types[] = array('crush_doc', 'crush_update');
        return $types;
    }
    
    add_filter('s2_post_types', 'my_post_types');

    Right now, S2 is *not* sending out emails to our Members for these post types. How can I fix this?

    https://ww.wp.xz.cn/plugins/subscribe2/

Viewing 2 replies - 1 through 2 (of 2 total)
  • @joshuaiz,

    The code you’ve pasted above is what’s causing the problem, are you trying to add these post types to the core ones or are you trying to replace and only send notifications for these custom post types?

    If you are trying to add you need to use:

    $types[] = 'crush_doc';
    $types[] = 'crush_update';

    If you are trying to replace you need:
    $types = array('crush_doc', 'crush_update');

    At the moment you are adding an array entry to an array instead of adding array entries.

    Thread Starter joshuaiz

    (@joshuaiz)

    Hi Matty,

    Yep I was trying to replace. Removed the index brackets and that fixed it – thanks!!!

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

The topic ‘Error in settings for CPT’ is closed to new replies.