_wp_customize_changeset_filter_insert_post_data

函数


_wp_customize_changeset_filter_insert_post_data ( $post_data, $supplied_post_data )
参数
  • (array)
    $post_data
    An array of slashed post data.
    Required:
  • (array)
    $supplied_post_data
    An array of sanitized, but otherwise unmodified post data.
    Required:
返回值
  • (array) Filtered data.
相关
  • wp_insert_post()
定义位置
  • wp-includes/theme.php
    , line 3603
引入
4.7.0
弃用

Filters changeset post data upon insert to ensure post_name is intact.

This is needed to prevent the post_name from being dropped when the post is
transitioned into pending status by a contributor.

function _wp_customize_changeset_filter_insert_post_data( $post_data, $supplied_post_data ) {
	if ( isset( $post_data['post_type'] ) && 'customize_changeset' === $post_data['post_type'] ) {

		// Prevent post_name from being dropped, such as when contributor saves a changeset post as pending.
		if ( empty( $post_data['post_name'] ) && ! empty( $supplied_post_data['post_name'] ) ) {
			$post_data['post_name'] = $supplied_post_data['post_name'];
		}
	}
	return $post_data;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。