diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
index 79f2b3eab3..252365c763 100644
a
|
b
|
final class WP_Customize_Manager { |
493 | 493 | return '_default_wp_die_handler'; |
494 | 494 | } |
495 | 495 | |
| 496 | /** |
| 497 | * Redirects to 404 when changeset UUID does not exists for unauthenticated users. |
| 498 | * |
| 499 | * @since 5.6.0 |
| 500 | * |
| 501 | * @param bool $bypass Pass-through of the pre_handle_404 filter value. |
| 502 | * @param WP_Query $query The WP_Query object. |
| 503 | * @return bool Bypass value. |
| 504 | */ |
| 505 | public function customize_changeset_preview_redirect( $bypass, $query ) { |
| 506 | $query->set_404(); |
| 507 | status_header( 404 ); |
| 508 | return $bypass; |
| 509 | } |
| 510 | |
496 | 511 | /** |
497 | 512 | * Start preview and customize theme. |
498 | 513 | * |
499 | 514 | * Check if customize query variable exist. Init filters to filter the current theme. |
500 | 515 | * |
501 | 516 | * @since 3.4.0 |
| 517 | * @since 5.6.0 Redirects to 404 when changeset UUID does not exists for unauthenticated users. |
502 | 518 | * |
503 | 519 | * @global string $pagenow |
504 | 520 | */ |
… |
… |
final class WP_Customize_Manager { |
548 | 564 | * then send unauthenticated code to prompt re-auth. |
549 | 565 | */ |
550 | 566 | if ( ! current_user_can( 'customize' ) && ! $this->changeset_post_id() ) { |
551 | | $this->wp_die( $this->messenger_channel ? 0 : -1, __( 'Non-existent changeset UUID.' ) ); |
| 567 | // As this is a preview page sending noindex in headers. |
| 568 | if ( ! headers_sent() ) { |
| 569 | nocache_headers(); |
| 570 | header( 'X-Robots: noindex, nofollow, noarchive' ); |
| 571 | } |
| 572 | add_action( 'wp_head', 'wp_no_robots' ); |
| 573 | add_filter( 'pre_handle_404', array( $this, 'customize_changeset_preview_redirect' ), 1, 2 ); |
552 | 574 | } |
553 | 575 | |
554 | 576 | if ( ! headers_sent() ) { |