C# 使用JoeBlogs/C将带有缩略图的帖子添加到Wordpress博客#

C# 使用JoeBlogs/C将带有缩略图的帖子添加到Wordpress博客#,c#,wordpress,joeblogs,C#,Wordpress,Joeblogs,我正在尝试添加带有拇指图像的新帖子,但仍然无法成功 public static int addContent(int postType, string title, string body, string post_thumbnail, string[] categories, string[] tags, DateTime dateCreated) { Post post = setPost(postType, title, body, post_thumbnail, categorie

我正在尝试添加带有拇指图像的新帖子,但仍然无法成功

 public static int addContent(int postType, string title, string body, string post_thumbnail, string[] categories, string[] tags, DateTime dateCreated)
{
  Post post = setPost(postType, title, body, post_thumbnail, categories, tags, dateCreated);
  using (var wrapper = getWordPressWrapper())
  {
    return wrapper.NewPost(post, true);
  }
}
获取setPost方法

public static Post setPost(int postType, string title, string body, string post_thumbnail, string[] categories, string[] tags, DateTime dateCreated)
{
  string type = postType == 1 ? "post" : "page";
  var customFields = new CustomField[] { 
    new CustomField() { 
        // Don't pass in ID. It's auto assigned for new custom fields.
        // ID = "name", 
        Key = "post_thumbnail", 
        Value = post_thumbnail
    } 
    //,
    //     new CustomField() { 
    //    // Don't pass in ID. It's auto assigned for new custom fields.
    //    // ID = "name", 
    //    Key = "post-thumbnail", 
    //    Value = post_thumbnail
    //}  ,
    //     new CustomField() { 
    //    // Don't pass in ID. It's auto assigned for new custom fields.
    //    // ID = "name", 
    //    Key = "post-thumbnails", 
    //    Value = post_thumbnail
    //} ,
    //     new CustomField() { 
    //    // Don't pass in ID. It's auto assigned for new custom fields.
    //    // ID = "name", 
    //    Key = "thumbnail", 
    //    Value = post_thumbnail
    //} 
  };
  return new Post
  {
    PostType = type,
    Title = title,
    Body = body,
    Categories = categories,
    Tags = tags,
    DateCreated = dateCreated,
    CustomFields = customFields
  };
}
正如你所看到的,它被评论了。我想尽一切办法贴拇指图片

我试过post_缩略图,post缩略图,post缩略图,缩略图键,但什么都没发生


我该怎么做?

假设缩略图已经上传,并且您知道它的媒体id

Key = "_thumbnail_id", 
Value = id_of_uploaded_thumbnail

应该行。

我已经试过你的钥匙和其他所有可能的方法了。没有什么变化。post_缩略图=“603”@tayfun只是想检查一下,如果你进入
domain.com?p=603
,它是否显示媒体附件?是的,我现在显示了。其已重定向到图像xxx.com/?p=603@tayfun我知道它已经关闭了,但可能有关联吗?您可以使用不同的XMLRPC客户端添加
\u缩略图\u id
元吗?我发现WordpressSharp但它不能正常工作。。我再等几天。。