XMLRPC API를 통해 새 게시물을 WordPress 블로그에 게시하려고합니다. 지금까지 잘 작동하지만 지금은 게시물에 태그를 추가하고 싶습니다. 생성 시점 또는 그 이후. 하지만 지원되는 API에서 솔루션을 찾을 수 없습니다.Wordpress XMLRPC를 통해 게시물에 태그 지정
XMLRPC 요청을 통해 새 게시물에 태그를 지정할 수있는 방법에 대한 단서가 있습니까?
XMLRPC API를 통해 새 게시물을 WordPress 블로그에 게시하려고합니다. 지금까지 잘 작동하지만 지금은 게시물에 태그를 추가하고 싶습니다. 생성 시점 또는 그 이후. 하지만 지원되는 API에서 솔루션을 찾을 수 없습니다.Wordpress XMLRPC를 통해 게시물에 태그 지정
XMLRPC 요청을 통해 새 게시물에 태그를 지정할 수있는 방법에 대한 단서가 있습니까?
mt_keywords 속성을 편집하십시오.
이 코드는
import redstone.xmlrpc.XmlRpcClient;
import java.util.HashMap;
public class wp {
public static void main(String args[]){
System.out.println("Inciando processo de publicação...");
// Get command-line arguments into variables
String sXmlRpcURL = "http://localhost/wordpress/xmlrpc.php";
String sUsername = "admin";
String sPassword = "mds123";
// Hard-coded blog_ID
int blog_ID = 1;
// XML-RPC method
String sXmlRpcMethod = "metaWeblog.newPost";
// We'll hard-code our blog content for now as well
String sContent = "Hello XML-RPC World! 5";
String sTitle = "Hello XML-RPC Title 5";
// Create our content struct
HashMap hmContent = new HashMap();
hmContent.put("title", sTitle);
hmContent.put("description", sContent);
hmContent.put("mt_keywords", "tag 1, tag 2");
// You can specify whether or not you want the blog published immediately
boolean bPublish = true;
// Try block
try
{
// Create the XML-RPC client
XmlRpcClient client = new XmlRpcClient(sXmlRpcURL, false);
// Make our method call
Object token = client.invoke(sXmlRpcMethod, new Object[] { new Integer(blog_ID), sUsername, sPassword, hmContent, new Boolean(bPublish) });
// The return is a String containing the postID
System.out.println("Posted : " + token.toString());
}
// Catch exceptions
catch(Exception e)
{
e.printStackTrace(System.err);
}
System.out.println("Fim do processo de publicação...");
}
}
도움이되기를 바랍니다