_wp_customize_changeset_filter_insert_post_data( array $post_data, array $supplied_post_data )

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

Description Description

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

Top ↑

See also See also

Top ↑

Parameters Parameters


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


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

Top ↑

Return Return

(array) Filtered data.

Top ↑

Source Source

File: wp-includes/theme.php

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;

Top ↑

Changelog Changelog

Version Description
4.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.