WordPress.org

Make WordPress Core

Ticket #42036: 42036.3.diff

File 42036.3.diff, 1.5 KB (added by joostdevalk, 22 months ago)

Patch v3

  • wp-admin/includes/admin-filters.php

     
    3838add_filter( 'media_upload_tabs', 'update_gallery_tab' );
    3939
    4040// Misc hooks.
     41add_action( 'admin_init', 'wp_admin_headers'         );
     42add_action( 'login_init', 'wp_admin_headers'         );
    4143add_action( 'admin_head', 'wp_admin_canonical_url'   );
    4244add_action( 'admin_head', 'wp_color_scheme_settings' );
    4345add_action( 'admin_head', 'wp_site_icon'             );
  • wp-admin/includes/misc.php

     
    920920}
    921921
    922922/**
     923 * Send a referrer policy header so referrers are not sent for WP admin pages.
     924 *
     925 * @since 4.9
     926 */
     927function wp_admin_headers() {
     928    $policy = 'same-origin';
     929
     930        /**
     931         * Filters the admin referrer policy
     932         *
     933         * @since 4.9
     934         *
     935         * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
     936         *
     937         * @param string $policy The referrer policy setting.
     938         */
     939    $policy = apply_filters( 'admin_referrer_policy', $policy );
     940
     941        header( sprintf( 'Referrer-Policy: %s', $policy ) );
     942}
     943
     944/**
    923945 * Outputs JS that reloads the page if the user navigated to it with the Back or Forward button.
    924946 *
    925947 * Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache,