Node-wordpress example

I am trying to run wordpress RPC methods using node-wordpress , but since there is no documentation at all, I am not sure what the correct way to run it is.

Could you show a few examples if you had the opportunity to work with him?

+4
source share
1 answer

I managed to do this by reading the module itself.

First you start the client:

var wp = wordpress.createClient({ "url": 'http://yourwordpressURL', "username": 'user', "password": 'pwd' }); 

than adding a message, for example, just make the following call:

 wp.newPost({ title: 'Your title', status: 'publish', //'publish, draft...', content: '<strong>This is the content</strong>', author: 3, // author id terms: {'category': [category_id]} }, function() { console.log(arguments); } }); 

All documentation for wordpress is at http://codex.wordpress.org/XML-RPC_WordPress_API/Posts

Hope this helps.

+6
source

Source: https://habr.com/ru/post/1436592/


All Articles