WordPress.org

Make WordPress Core

Ticket #25072: no-cache-wp-cron.php

File no-cache-wp-cron.php, 552 bytes (added by westonruter, 8 years ago)

mu-plugin to send no-cache response headers from wp-cron.php

Line 
1<?php
2/*
3Plugin name: Send no-cache response header from wp-cron.php requests
4Description: When WordPress is behind a caching proxy, ensure that the system cron pings to wp-cron.php do not hit the proxy cache but hit WordPress each time.
5Plugin URL: http://core.trac.wordpress.org/ticket/25072
6Author: X-Team
7Author URI: http://x-team.com/
8Version: 1.0
9*/
10
11if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
12        add_filter( 'nocache_headers', function ( $headers ) {
13                $headers['Surrogate-Control'] = 'no-store';
14                return $headers;
15        });
16        nocache_headers();
17}