Make WordPress Core


Ignore:
Timestamp:
01/29/2025 06:10:47 PM (15 months ago)
Author:
johnbillion
Message:

Posts, Post Types: Add no-cache headers to password protected posts.

This instructs an intermediate cache, for example a proxy server, to not cache a password protected post both before and after a visitor has entered a password.

Props brevilo, haozi, ironprogrammer, narenin

Fixes #61711

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp.php

    r59133 r59728  
    546546                $headers['X-Pingback'] = get_bloginfo( 'pingback_url', 'display' );
    547547            }
     548
     549            // Send nocache headers for password protected posts to avoid unwanted caching.
     550            if ( ! empty( $post->post_password ) ) {
     551                $headers = array_merge( $headers, wp_get_nocache_headers() );
     552            }
    548553        }
    549554
Note: See TracChangeset for help on using the changeset viewer.