/**
  * Delete an existing instruction.
  *
  * @since 1.3.0
  *
  * @param  int  $instruction_id The ID for the instruction you want to delete.
  * @return bool $result         Whether the instruction was deleted.
  */
 public function delete_instruction($instruction_id)
 {
     $result = simmer_delete_recipe_item($instruction_id);
     if ($result) {
         simmer_delete_recipe_item_meta($instruction_id, 'description');
         simmer_delete_recipe_item_meta($instruction_id, 'is_heading');
     }
     return $result;
 }
예제 #2
0
 /**
  * Remove a recipe's items when it is deleted.
  *
  * @since 1.3.0
  *
  * @param int $recipe_id The recipe ID.
  */
 public function delete_recipe_items($recipe_id)
 {
     if (!current_user_can('delete_posts')) {
         return;
     }
     if (simmer_get_object_type() !== get_post_type($recipe_id)) {
         return;
     }
     $items = simmer_get_recipe_items($recipe_id);
     foreach ($items as $item) {
         simmer_delete_recipe_item($item->recipe_item_id);
     }
 }
 /**
  * Delete an existing ingredient.
  *
  * @since 1.3.0
  *
  * @param  int  $ingredient_id The ID for the ingredient you want to delete.
  * @return bool $result        Whether the ingredient was deleted.
  */
 public function delete_ingredient($ingredient_id)
 {
     $result = simmer_delete_recipe_item($ingredient_id);
     if ($result) {
         simmer_delete_recipe_item_meta($ingredient_id, 'amount');
         simmer_delete_recipe_item_meta($ingredient_id, 'unit');
         simmer_delete_recipe_item_meta($ingredient_id, 'description');
     }
     return $result;
 }