wordpress-client

WordPress XML-RPC client.

Usage no npm install needed!

<script type="module">
  import wordpressClient from 'https://cdn.skypack.dev/wordpress-client';
</script>

README

Stories in Ready Dependency status Dev Dependency Status Master status Dev status Build Status Code Climate

WordPress XML-RPC client.

resources:

  • "https://usabilitydynamics.com/technical/project-yaml/"
  • "https://github.com/scottgonzalez/grunt-wordpress"
  • "https://www.npmjs.org/package/grunt-wordpress-deploy"
  • "https://www.npmjs.org/package/wp-util"
  • "https://www.npmjs.org/package/wordpress-rpc"

Features

  • Automated batching of RPC calls.

Methods

Instance methods resemble WordPress functions used in PHP development.

  • client.insertPost()
  • client.uploadFile()

Usage


// Load module and create an instance.
var client = require( 'wordpress-client' ).create({
  url: 'http://my-site.com/xmlrpc.php',
  username: 'admin',
  password: 'secret-password'
});

// Uplaod File
client.uploadFile({
  'name': 'my_file.jpg',
  'bits': require( 'fs' ).readFileSync( './path/to/file.jpeg' )
});

Notes

  • All callbacks are called in context of client's instance.
  • Authenticated vs non-authenticated calls are automatically selected based on type of endpoint.
  • BlogID is automatically selected based on url