NavMenuActions.php
4 years ago
NavMenuFrontEnd.php
3 years ago
NavMenuRemoveItem.php
8 years ago
NavMenuRepository.php
4 years ago
NavMenuSync.php
3 years ago
NavMenuSyncListing.php
6 days ago
NavMenuSyncMenu.php
8 years ago
NavMenuTrashActions.php
7 years ago
NavMenuRemoveItem.php
28 lines
| 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 | } |