• I am using custom post types and custom taxonomies with Subscribe2. Users on my site can choose to subscribe to a number of these taxonomy terms.

    When I publish a custom post immediately, Subscribe2 functions as expected and sends a post notification to the users that are subscribed to that custom taxonomy. However, when I schedule a custom post, email notifications are sent to ALL subscribers, whether they are subscribed to that taxonomy term or not.

    I am using WP-Crontrol to deal with missed scheduled posts and it seems to be functioning properly.

    Can anyone point me in the right direction?

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • @bstumbo1

    This hasn’t been reported before, please can you tell me how the custom post type and taxonomy are being created and also paste the code snippet on here for how you are registering the custom post type and taxonomy for Subscribe2?

    Thread Starter bstumbo1

    (@bstumbo1)

    I’ve created a simple plugin to handle custom post/taxonomy registration. Thanks in advance for any help you can provide. Here is the code I’m using:

    /* Document Types */

    function my_post_types($types) {

    $types[] = ‘business_doc’;
    $types[] = ‘approp_doc’;
    $types[] = ‘defense_docs’;
    $types[] = ‘a-e-h’;
    $types[] = ‘energy_doc’;
    $types[] = ‘foreign_affaris’;
    $types[] = ‘health_care’;
    $types[] = ‘civil_rights’;
    $types[] = ‘native_docs’;
    $types[] = ‘technology_docs’;

    return $types;
    }
    add_filter(‘s2_post_types’, ‘my_post_types’);

    /* Taxonomies */

    function my_taxonomies($taxonomies) {
    $taxonomies[] = ‘business_alert’;
    $taxonomies[] = ‘approp_alert’;
    $taxonomies[] = ‘defense_alert’;
    $taxonomies[] = ‘aeh_alert’;
    $taxonomies[] = ‘energy_alert’;
    $taxonomies[] = ‘foreign_alert’;
    $taxonomies[] = ‘healthcare_alert’;
    $taxonomies[] = ‘civil_rights_alert’;
    $taxonomies[] = ‘native_alert’;
    $taxonomies[] = ‘technology_alert’;

    return $taxonomies;
    }
    add_filter(‘s2_taxonomies’, ‘my_taxonomies’);

    @bstumbo1

    Still need an answer to this bit:

    please can you tell me how the custom post type and taxonomy are being created

    Thread Starter bstumbo1

    (@bstumbo1)

    Sorry, I’m using the the “GD Custom Posts and Taxonomy Tools” plugin.

    It occurs to me now that it might have something to do with my custom post “capabilities”. But they should have the same capabilities as a standard post.

    @bstumbo1

    Your code snippets look fine and this is a strange one – if it works for instantly published content it should also work for scheduled content too.

    The only thing I can think it might be right now is that the taxonomy is not linked to the custom post type.

    Thread Starter bstumbo1

    (@bstumbo1)

    @mattyrob

    I think you are probably on the right track. I’ve been doing some digging through my error logs and was able to capture these three errors when a scheduled post actually goes live:

    Error 1
    [Sat Jan 31 18:10:23 2015] [error] [client 98.204.53.242] PHP Warning: in_array() expects parameter 2 to be array, object given in /nas/wp/www/cluster-2162/congressdocs/wp-content/plugins/subscribe2/classes/class-s2-core.php on line 410, referer: http://congressionaldocs.com/wp-admin/edit.php?post_type=a-e-h

    Error 2
    [Sat Jan 31 18:10:23 2015] [error] [client 98.204.53.242] PHP Warning: implode() [function.implode]: Invalid arguments passed in /nas/wp/www/cluster-2162/congressdocs/wp-content/plugins/subscribe2/classes/class-s2-core.php on line 442, referer: http://congressionaldocs.com/wp-admin/edit.php?post_type=a-e-h

    Error 3
    [Sat Jan 31 18:10:23 2015] [error] [client 98.204.53.242] PHP Warning: implode() [function.implode]: Invalid arguments passed in /nas/wp/www/cluster-2162/congressdocs/wp-content/plugins/subscribe2/classes/class-s2-core.php on line 482, referer: http://congressionaldocs.com/wp-admin/edit.php?post_type=a-e-h

    Are these errors thrown because custom post types and taxonomy aren’t linked?

    @bstumbo1

    Does this just apply to the a-e-h post type or have you noticed this with other post types also?

    Certainly those errors are all related to the taxonomy data for a post. So, this does look like post type and taxonomy linking. You might need to investigate using the register_taxonomy_for_object_type() function to link taxonomies to post types.

    That said if Subscribe2 works fine for posts that are immediately published (instead of scheduled) I suspect there may be a glitch in the custom post / taxonomy plugin you are using that doesn’t load certain parts of the code when a post is scheduled rather than immediately published, so it might be worth raising on that forum.

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

The topic ‘Custom Post Type/Scheduled Posts Issue’ is closed to new replies.