/** * When a post is deleted, remove it from Apple News. * * @since 0.4.0 * @param int $id * @access public */ public function do_delete($id) { if (!current_user_can(apply_filters('apple_news_delete_capability', 'manage_options'))) { return; } // If it does not have a remote API ID just ignore if (!get_post_meta($id, 'apple_news_api_id', true)) { return; } $action = new Apple_Actions\Index\Delete($this->settings, $id); try { $action->perform(); } catch (Apple_Actions\Action_Exception $e) { Admin_Apple_Notice::error($e->getMessage()); } }
/** * Handles a delete from Apple News action. * * @param int $id * @access private */ private function delete_action($id) { $action = new Apple_Actions\Index\Delete($this->settings, $id); try { $action->perform(); $this->notice_success(__('Your article has been removed from apple news.', 'apple-news')); } catch (Apple_Actions\Action_Exception $e) { $this->notice_error($e->getMessage()); } }