Ticket #50781: 50781.patch
File 50781.patch, 1.7 KB (added by , 4 years ago) |
---|
-
class-wp-customize-manager.php
492 492 493 493 return '_default_wp_die_handler'; 494 494 } 495 496 495 /** 496 * Redirects a URL to the 404 page if changeset UUID does not exists for unauthenticated users 497 * 498 * @since 5.5.0 499 * 500 * @param bool $bypass Pass-through of the pre_handle_404 filter value. 501 * @param WP_Query $query The WP_Query object. 502 * @return bool Bypass value. 503 */ 504 public function customize_changeset_preview_redirect( $bypass, $query ) { 505 $query->set_404(); 506 status_header(404); 507 return $bypass; 508 } 509 /** 497 510 * Start preview and customize theme. 498 511 * 499 512 * Check if customize query variable exist. Init filters to filter the current theme. … … 547 560 * In this way, the UUID serves as a secret key. If the messenger channel is present, 548 561 * then send unauthenticated code to prompt re-auth. 549 562 */ 550 if ( ! current_user_can( 'customize' ) && ! $this->changeset_post_id() ) { 551 $this->wp_die( $this->messenger_channel ? 0 : -1, __( 'Non-existent changeset UUID.' ) ); 552 } 553 563 if (! current_user_can( 'customize' ) && ! $this->changeset_post_id() ) { 564 /* 565 * As this is a preview page sending noindex in headers. 566 */ 567 if ( ! headers_sent() ) { 568 nocache_headers(); 569 header( 'X-Robots: noindex, nofollow, noarchive' ); 570 } 571 add_action( 'wp_head', 'wp_no_robots' ); 572 add_filter( 'pre_handle_404', array( $this, 'customize_changeset_preview_redirect' ), 1, 2 ); 573 } 554 574 if ( ! headers_sent() ) { 555 575 send_origin_headers(); 556 576 }