Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

yonbeastie on "[Plugin: Polylang] AJAX Requests to wp_insert_post"

$
0
0

Before the wp_die is reached, the post has already been created/updated (unless a permissions error has already been thrown).

In my scenario, I have a service doing an ajax call to /wp-admin/admin-ajax.php and a plugin facilitates creating/editing a post via call_user_func_array( $func, $args ). The post is created/edited successfully, which would normally produce a structured response to the service. With the Polylang plugin installed, the response is replaced by the output of wp_die().

I think the issue is that Polylang requires that a user session be active, but wp_insert_post() and wp_update_post() don't expressly require a user to be logged in. Creating/editing blog posts remotely with token-authenticated calls to /wp-admin/admin-ajax.php is becoming fairly common.


Viewing all articles
Browse latest Browse all 11471

Trending Articles