• Hello,

    I’m trying to synchronize my latest post to local social network. The code I searched from internet could synchronize the latest post from default post type “post” only. However, I still have other 3 custom post types, let we say “experience”, “deal”, “value”. I believe there should be some code to be added at the beginning, but I don’t know how to do.
    Could somebody help, thank you!

    if(get_post_meta($post_ID,'weibo_sync',true) == 1) return;
       $get_post_info = get_post($post_ID);
       $get_post_centent = get_post($post_ID)->post_content;
       $get_post_title = get_post($post_ID)->post_title;
       if ($get_post_info->post_status == 'publish' && $_POST['original_post_status'] != 'publish') {
           $appkey=''; /*  */
           $username='';
           $userpassword='';
         $request = new WP_Http;
    	 $keywords = ""; 
    
           /* get the thumbnail picture */
           $url = get_mypost_thumbnail($post_ID);
    
           /* if success, add weibo_sync to avoid the post re-sync to weibo again when update */
           add_post_meta($post_ID, 'weibo_sync', 1, true);
        }
    }
    add_action('publish_post', 'post_to_sina_weibo', 0);
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get latest $post_id from multi post types’ is closed to new replies.