我使用Redstone的 XMLRPC Api 在 Wordpress 上发帖。尽管发布了帖子,但未正确设置固定链接。我的代码:
XmlRpcClient client = new XmlRpcClient("xmlrpc link...", true);
HashMap hmContent = new HashMap();
hmContent.put("title", "my post title");
hmContent.put("description", "my new post");
hmContent.put("permaLink", "my-brand-new-post"); <- this should be the permalink
token = client.invoke("metaWeblog.newPost", new Object[] {new Integer(1),
"username",
"password",
hmContent,
true} );
我设置的永久链接被忽略,Wordpress 根据帖子标题创建了一个永久链接。什么可能导致这种情况?
编辑:添加“wp_slug”值就可以了。虽然“蛞蝓”并不意味着这个我认为:
hmContent.put("wp_slug", "my-brand-new-post");