2012-03-06 59 views
0

我在Wordpress上使用來自Redstone的XMLRPC Api進行發佈。儘管這篇文章已經發布,但永久鏈接沒有正確設置。我的代碼:WordPress的XMLRPC(紅石)永久鏈接不工作

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」值是有用的。雖然"slug"並不意味着爲了這個,我覺得:

hmContent.put("wp_slug", "my-brand-new-post"); 
+0

你能幫我嗎我調用wordpress後調用對象響應時遇到問題。在獲得對象名稱標記之後,您是如何使用這些信息的?我得到這樣的東西 {item_one = info,item_two = info ...} – inspired 2013-09-19 00:03:13

回答

1

您也可以嘗試WordPress的Java的設置後的廢料。看看這個:

setWp_slug()在WordPress的Java

永久和蛞蝓是不同的東西,塞指的是最後一個「/」的永久的分割部分。你不能全部改變固定鏈接,但你可以通過slug改變最後一部分。

+0

嗨,可以,這也應該工作:)雖然Wordpress-Java庫是使用Redstone XMLRPC本身的權利? – BigJ 2012-03-12 13:59:43

+0

是的,但是隱藏了這個,這樣我們的神仙不必將無類型的數組和函數名稱作爲字符串處理:) – 2012-03-15 14:39:00