Exemplo n.º 1
0
 /**
  * Removes the post from the tree.
  *
  * Called the delete_post hook.
  *
  * @param int $post_id Post ID.
  *
  * @return boolean
  */
 public function delete_post($post_id)
 {
     if (!$this->app->semaphore()->is_open()) {
         return $this->app->response()->error(new WP_Error('semaphore_locked', sprintf(__('%s : Semaphore is locked, import/export already in progress.', 'wordpress-github-sync'), 'Controller::delete_post()')));
     }
     $this->app->semaphore()->lock();
     $result = $this->app->export()->delete($post_id);
     $this->app->semaphore()->unlock();
     if (is_wp_error($result)) {
         return $this->app->response()->error($result);
     }
     return $this->app->response()->success($result);
 }