exit404 function change suggestion
-
Hello,
Thank you for your latest version! I’m glad you’re back. ??
Regarding the exit404 function, my previous suggestion wasn’t more than a thought. As a matter of fact, just as it is, almost nothing is loaded and this doesn’t work.
So I suggest something else -that I actually use- that would be to modify this function as follow (even if this could have a frontend to activate or select 404 behavior…):function exit404( $message ) { header( 'Cache-Control:?no-cache,?must-revalidate' ); // HTTP/1.1 header( 'Expires:?Sat,?26?Jul?1997?05:00:00?GMT' ); // past date if ( WP_DEBUG ) { header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' 404 Not Found' ); echo $message; } else { header ('HTTP/1.1 301 Moved Permanently'); header ("Location: /404"); // Or any page that doesn't exist... } exit(); }
Redirecting offers an easy way to get the WordPress 404 page.
HTTP redirection code could be either 301 or 302, as selected by the webmaster (302 could help if the error was not meant to be…).What do you think about it?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘exit404 function change suggestion’ is closed to new replies.