How to use metaWeblog.getPost, metaWeblog.getRecentPosts and metaWeblog.deletePost

How to use metaWeblog.getPost, metaWeblog.getRecentPosts and metaWeblog.deletePost

Continuing my article on Simple WordPress XMLRPC with IXR_Library Class, I will share about how to use metaWeblog.getPost, metaWeblog.getRecentPosts and metaWeblog.deletePost. I combine these three APIs in the article because it is easy to use and are rarely used.

Lets begin tutorial.

To using these wordpress API we need IXR_Library Class.

 metaWeblog.getRecentPosts 

metaWeblog.getRecentPosts used to get data from the end of your blog posts, MetaWeblog.getRecentPosts will retrieve a list of recent posts. Parameters required

  • int blogid : Not applicable for WordPress, can be any value and will be ignored.
  • string username
  • string password
  • int numberOfPosts : Optional. (In my example i retrieve 3 recent posts)

Result :

how to use metaWeblog.getRecentPosts return result

 metaWeblog.getPost 

MetaWeblog.getPost equal with metaWeblog.getRecentPosts, but metaWeblog.getPost only restore specific posts based postid. Here the metaWeblog.getPost parameters

  • int postid
  • string username
  • string password

 metaWeblog.deletePost 

Use for Delete an existing post. With metablog.deletePost will move the blog post to the trash. Parameter required is

  • string appkey: Not applicable for WordPress, change with ” “.
  • int postid
  • string username
  • string password
  • bool publish: Will be ignored with false.

Thus tutorial how to use the MetaWeblog API to wordpress, please read another tutorial using XMLRPC with MetaWeblog here.

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Latest posts by Sigit Prasetya Nugroho (see all)

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.