How to change all 404 to 410 error code in Wordpress

How to change all 404 to 410 error code in WordPress

If you want to change all 404 error of your WordPress website into 410 error statues then just add this code before the get_header(); in you 404.php template

<?php
// Set 410 - GONE status for all 404 pages
header($_SERVER["SERVER_PROTOCOL"] . " 410 Gone");

get_header();
?>

Hope it helps.

Reference: stackoverflow.com

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top