function custom_http_headers() { if (is_singular()) { // For dynamic content (e.g., single posts, pages) header('Cache-Control: no-cache, no-store, must-revalidate'); header('Pragma: no-cache'); header('Expires: 0'); } else { // For static assets (e.g., images, CSS, JS) header('Cache-Control: public, max-age=31536000, immutable'); header('ETag: "static-content-version-1"'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime(__FILE__)) . ' GMT'); } } add_action('send_headers', 'custom_http_headers');