Skip to content

Instantly share code, notes, and snippets.

@fliespl
fliespl / functions.php
Created December 31, 2023 17:52 — forked from MikeNGarrett/functions.php
Set cache headers on WordPress 404 pages.
<?php
/**
* Force cache headers on 404 pages and prevent WordPress from handling 404s.
*
* @param bool $preempt determines who handles 404s.
* @param obj $wp_query global query object.
*/
function change_404_headers( $preempt, $wp_query ) {
if ( ! is_admin() && ! is_robots() && count( $wp_query->posts ) < 1 ) {
header( 'Cache-Control: max-age=30000, must-revalidate' );
@fliespl
fliespl / gist:6621fbe48e9da6bdbb805e32316695f9
Created December 1, 2018 10:36 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>