0

I was wondering how to set the filter option for wp.getPosts. I want to get posts with a status of 'trash'. filter is currently blank, and returns all posts other than trash.

I am using the xmlrpc wordpress api and the node-wordpress plugin. https://github.com/scottgonzalez/node-wordpress

Here is my current code:

wp.getPosts('<filter>', ['title','status'], function(err, data){

});

I am not sure what to put in the filter section, all the examples I could find are PHP examples and do not work in this context where I am using Javascript.

Is it even possible to get the posts with a status of 'trash'?

0

I think you're looking for this...

wp.getPosts({
      status: 'trash',
    },
    ['title','status'],
    function( err, data ) {
      console.log( data );
    }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.