WordPress.org

Make WordPress Core

Ticket #40787: 40787.diff

File 40787.diff, 782 bytes (added by kraftbj, 2 years ago)

Check if headers_sent is false before firing header

  • src/wp-includes/rest-api.php

     
    489489                $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
    490490        }
    491491
    492         header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) );
     492        if ( ! headers_sent() ) {
     493                header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) );
     494        }
    493495}
    494496
    495497/**
     
    510512                $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
    511513        }
    512514
    513         header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) );
     515        if ( ! headers_sent() ) {
     516                header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) );
     517        }
    514518}
    515519
    516520/**