Medium / medium-wordpress-plugin

The official WordPress plugin for cross-posting to Medium.
https://medium.com
Apache License 2.0
210 stars 40 forks source link

Cross posting is not triggered when creating post via WP rest api #119

Open nextpulse opened 7 years ago

nextpulse commented 7 years ago

Using the WP REST api to create a post, the Medium's save_post is not triggered. Only a 'manual' update via the WP editor will trigger the save_post.

nextpulse commented 7 years ago

Just took a look at the code. So the issue is in medium.php

It is using is_admin() to assign triggers. This is a 'view' based trigger - hence programmatic post creation fails.

https://codex.wordpress.org/Function_Reference/is_admin

Seems current_user_can() maybe better.

https://codex.wordpress.org/Function_Reference/current_user_can

timnolte commented 7 years ago

@nextpulse did you submit a PR for this by chance? Really need to see this fixed as I use the Android app for about 95% of my blog posts.