Created
December 21, 2023 09:27
-
-
Save rilwis/a7ca4bc716c0036624d7068dd5742498 to your computer and use it in GitHub Desktop.
Set status 410 for deleted pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'template_redirect', function () { | |
if ( ! is_404() ) { | |
return; | |
} | |
$path = trim( $_SERVER['REQUEST_URI'] ?? '', '/' ); | |
if ( $path === 'your-deleted-page' ) { | |
status_header( 410 ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment