| 1 |
<?php |
| 2 |
namespace NestedPages\Entities\NavMenu; |
| 3 |
|
| 4 |
/** |
| 5 |
* Service Class for removing a single menu item |
| 6 |
*/ |
| 7 |
class NavMenuRemoveItem |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Item ID to Remove |
| 11 |
* @var int - ID of nav menu item |
| 12 |
*/ |
| 13 |
private $item_id; |
| 14 |
|
| 15 |
public function __construct($item_id) |
| 16 |
{ |
| 17 |
$this->item_id = $item_id; |
| 18 |
$this->removeItem(); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Delete the Item |
| 23 |
*/ |
| 24 |
private function removeItem() |
| 25 |
{ |
| 26 |
wp_delete_post($this->item_id, true); |
| 27 |
} |
| 28 |
} |