【问题标题】:Send post-tags to wordpress within XML-RPC在 XML-RPC 中将 post-tags 发送到 wordpress
【发布时间】:2012-01-29 08:30:45
【问题描述】:

我在 C# 中使用 XML-RPC.net 3 和 joeblog dll。一切正常,但我无法创建帖子标签并将其发送到 WordPress。 我可以创建带有类别、标题、摘录、内容、剪切字段的帖子,但无法成功创建帖子标签。 这是我的代码:

 public void createPost(newPost np)
        {
            loginformobject = new LoginForm();
            string postid;
            icp = (IcreatePost)XmlRpcProxyGen.Create(typeof(IcreatePost));
            clientProtocol = (XmlRpcClientProtocol)icp;
            clientProtocol.Url = url.Text;
            try
            {
                postid = icp.NewPost(1, User.Text, Pass.Text, np, 1);

            }
            catch (Exception ex)
            {
                MessageBox.Show("createPost ERROR ->" + ex.Message);
            }
        }

 private void button1_Click(object sender, EventArgs e)
        {
            customField newCustomField2 = default(customField);

            newCustomField2.key = "Testttttttttttt";

            newCustomField2.value = "testttvalye";



            newPost newBlogPost = default(newPost);
            newBlogPost.title = "Some Title<AliReza Test>";
            newBlogPost.description = "Some description Test Test Test Test<AliReza Test>";
            newBlogPost.custom_fields = new customField[] { newCustomField2 };
            newBlogPost.categories = new string[] { "Test" };
            newBlogPost.mt_excerpt = "Tozihate Kotah";
            newBlogPost.mt_taxonomy = new string[] { "test","test2" };
            createPost(newBlogPost);
        }

如何在 C# 中的 XML-RPC 中发送带有标签的帖子?

是否有任何库或代码来创建帖子标签?

感谢您的帮助。

【问题讨论】:

    标签: c# xml-rpc


    【解决方案1】:

    解决这个问题

     public string[] categories;
        public string title;
        public string description;
        public string mt_excerpt;
        public customField[] custom_fields;
        public string[] mt_keywords;
    

    newBlogPost.mt_keywords = new string []{ "t1","t2"};
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多