• vleap

    (@vleap)


    Hello

    I have had a plugin developed that imports posts from an XML file into wordpress. The import works fine, but the published posts are not triggering pings or other plugins that act on a pubish event (e.g. a twitter posting plugin such as tweetly).

    It uses the wp api.. inserts the post initially as “draft” with a ping_status of “open” the following code:

    $my_post = array();
    $my_post[‘post_title’] = $Heading;
    $my_post[‘post_name’] = $post_slug;
    $my_post[‘post_content’] = $Content;
    $my_post[‘post_status’] = ‘draft’;
    $my_post[‘post_author’] = $AutorID;
    $my_post[‘post_category’] = array($term_id);

    $my_post[‘ping_status’] = ‘open’;
    $my_post[‘to_ping’] = ”;
    $my_post[‘pinged’] = ”;
    $my_post[‘post_date’] = $post_date;
    $my_post[‘post_date_gmt’] = $post_date;
    $my_post[‘post_type’] = ‘post’;

    $post_ID = wp_insert_post($my_post);

    do_action(‘publish_post’, $post_ID);
    wp_publish_post($post_ID);

    The posts are posted (added) and are published – and so this code seems to be working.

    But – the posts are never pinged.. and the twitter plugin (tweetly) doesn’t pick it up either. Both of these work when manually adding a post.

    Any advice / guidance would be appreciated.

    Thanks in advance

  • The topic ‘Plugin not triggering ping or other plugins’ is closed to new replies.