GC_Customize_Manager::preserve_insert_changeset_post_content()

最后更新于:2021-11-27 01:17:23

GC_Customize_Manager::preserve_insert_changeset_post_content( array$data, array$postarr, array$unsanitized_postarr)

Preserve the initial JSON post_content passed to save into the post.

参数

$data

(array) (Required) An array of slashed and processed post data.

$postarr

(array) (Required) An array of sanitized (and slashed) but otherwise unmodified post data.

$unsanitized_postarr

(array) (Required) An array of slashed yet *unsanitized* and unprocessed post data as originally passed to gc_insert_post().

响应

(array) Filtered post data.

源文件

文件: gc-includes/class-gc-customize-manager.php

	public function preserve_insert_changeset_post_content( $data, $postarr, $unsanitized_postarr ) {
		if (
			isset( $data['post_type'] ) &&
			isset( $unsanitized_postarr['post_content'] ) &&
			'customize_changeset' === $data['post_type'] ||
			(
				'revision' === $data['post_type'] &&
				! empty( $data['post_parent'] ) &&
				'customize_changeset' === get_post_type( $data['post_parent'] )
			)
		) {
			$data['post_content'] = $unsanitized_postarr['post_content'];
		}
		return $data;
	}