static function delete($post_ID) { // global $grape_synced; if (!GrapePostController::check_nonce()) { return $post_ID; } $post = new GrapePost($post_ID); if (!$post->was_synced()) { grape_debug("controller: delete -> STOP (was never synced before)"); return $post_ID; } do_action('grape_post_delete', $post); foreach ($post->get_connections() as $connection) { $post->use_custom_title_field($connection['custom_title_field']); $api = new GRAPE_API($connection['api_token'], $connection['api_url']); $api->delete($post); } return $post_ID; }
function grape_full_sync_start() { global $wpdb; $result = true; // TODO: implement syncing of taxonomies $options = grape_get_options(); foreach ($options['syncables']['post_type'] as $post_type => $connections) { foreach ($connections as $connection) { $api = new GRAPE_API($connection['api_token'], $connection['api_url']); $result = $result && $api->delete_everything(); } } wp_die(); // this is required to terminate immediately and return a proper response }