0

I'm posting on Wordpress using the XMLRPC Api from Redstone. Although the post is made, the permalink is not set correctly. My code:

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} );

The permalink I have set is ignored and Wordpress had create a permalink based on the post title. What could cause this?

Edit: adding "wp_slug" value does the trick. Although "slug" isn't meant for this I think:

hmContent.put("wp_slug", "my-brand-new-post");
BigJ
  • 1,990
  • 2
  • 29
  • 47
  • Can you help me I'm having a problem using the object response after invoking a call to wordpress. After you got the object you name token how did you use the information? I get something like this {item_one=info, item_two=info...} – Abdullah Rasheed Sep 19 '13 at 00:03

1 Answers1

1

You could also try wordpress-java for setting the slug of the post. Have a look at this:

setWp_slug() in wordpress-java

Permalink and slug are different things, slug refers to the last "/" divided part of the permalink. You can't change a permalink in full, but you can change the last part via the slug.

Can Bican
  • 366
  • 5
  • 16
  • Hi Can, that should also work :) Though the Wordpress-java library is using the Redstone XMLRPC itself right? – BigJ Mar 12 '12 at 13:59
  • Yes it does, but hides this so that we immortals don't have to deal with untyped arrays and function names as strings :) – Can Bican Mar 15 '12 at 14:39