$input_changeset_data =
json_decode( wp_unslash( $_POST['customize_changeset_data'
] ), true
);
if ( !
is_array( $input_changeset_data ) ) { wp_send_json_error( 'invalid_customize_changeset_data'
);
} } else { $input_changeset_data = array
();
} // Validate title.
$changeset_title = null;
if ( isset( $_POST['customize_changeset_title'
] ) ) { $changeset_title =
sanitize_text_field( wp_unslash( $_POST['customize_changeset_title'
] ) );
} // Validate changeset status param.
$is_publish = null;
$changeset_status = null;
if ( isset( $_POST['customize_changeset_status'
] ) ) { $changeset_status =
wp_unslash( $_POST['customize_changeset_status'
] );
if ( !
get_post_status_object( $changeset_status ) || !
in_array( $changeset_status, array
( 'draft', 'pending', 'publish', 'future'
), true
) ) { wp_send_json_error( 'bad_customize_changeset_status', 400
);
} $is_publish =
( 'publish' ===
$changeset_status || 'future' ===
$changeset_status );