1

I'm using the Wordpress API to update tribe events. The updates are successfully sent (and the change is made) but as a side-effect, any time I do it, the featured image is removed from the post...

wpapi package setup: Because The Events Calendar has it's own routes that aren't built-in by default in the wpapi package, I use the wp.registerRoute function to set that up. I don't think there's a problem with the way I set that up because otherwise it works.

var WPAPI = require( 'wpapi' );
var wp = new WPAPI({
  endpoint: 'https://www.example.com/wp-json',
  username: 'username',
  password: 'mypassword'
});
wp.tribeevent = wp.registerRoute('tribe/events/v1', '/events/(?P<id>)');

example update:

function showEvent (post_id) {
  let data = { "hide_from_listings" : false }
  wp.tribeevent().id(post_id).update(data)
}

Haven't been able to find anyone with this issue online, so I'm posting here after exhausting myself trying to get it to work without removing the image... Am I doing this wrong? Is this just a bug? Any suggested workarounds?

I've also tried adding the existing image info into the update data sent, but I get this response when doing so:

{
    "error": {
        "code": "rest_invalid_param",
        "message": "Invalid parameter(s): image",
        "data": {
            "status": 400,
            "params": {
                "image": "Invalid parameter."
            },
            "details": []
        }
    }
}

Otherwise, when making an update such as { "hide_from_listings" : false }, when the json response comes back, the value of the image key just comes back as false: { "image" : false }

Would greatly appreciate any kind of input on this issue...

0 Answers0