Make WordPress Core

Changeset 28970


Ignore:
Timestamp:
07/03/2014 04:10:01 PM (10 years ago)
Author:
SergeyBiryukov
Message:

Prevent sending a 404 status when returning the response for the customize preview, since it causes the jQuery Ajax to fail. Send 200 instead.

props westonruter.
fixes #27992.

File:
1 edited

Legend:

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

    r28861 r28970  
    407407
    408408        wp_enqueue_script( 'customize-preview' );
     409        add_action( 'wp', array( $this, 'customize_preview_override_404_status' ) );
    409410        add_action( 'wp_head', array( $this, 'customize_preview_base' ) );
    410411        add_action( 'wp_head', array( $this, 'customize_preview_html5' ) );
     
    426427         */
    427428        do_action( 'customize_preview_init', $this );
     429    }
     430
     431    /**
     432     * Prevent sending a 404 status when returning the response for the customize
     433     * preview, since it causes the jQuery Ajax to fail. Send 200 instead.
     434     *
     435     * @since 4.0.0
     436     */
     437    public function customize_preview_override_404_status() {
     438        if ( is_404() ) {
     439            status_header( 200 );
     440        }
    428441    }
    429442
Note: See TracChangeset for help on using the changeset viewer.