How to delete CMS Page by Id programmatically in Magento 2?

You can delete CMS Page by Page id in Magento 2 using PageRepositoryInterface interface.

Magento\Cms\Api\PageRepositoryInterface interface is responsible for delete a CMS page from admin panel.

You just need to inject interface in your constructor to delete CMS page.

<?php

namespace Path\To\Module;

use Magento\Cms\Api\PageRepositoryInterface;
use Magento\Framework\Exception\LocalizedException;

class CmsPage {

public function __construct(
    PageRepositoryInterface $pageRepository
) {
    $this->pageRepository = $pageRepository;
}

/**
 * @param int $pageId
 * @return bool
 */
public function deleteCmsPage(int $pageId)
{
    try {
        $result = $this->pageRepository->deleteById($pageId);
    } catch (LocalizedException $exception) {
        throw $exception->getMessage();
    }
    return $result;
}

}

You just have to pass CMS page id in deleteCmsPage(1) function to delete specific CMS Page.