_wp_get_allowed_postdata( array|WP_Error|null $post_data = null ): array|WP_Error

In this article

Returns only allowed post data fields.

Parameters

$post_dataarray|WP_Error|nulloptional
The array of post data to process, or an error object.
Defaults to the $_POST superglobal.

Default:null

Return

array|WP_Error Array of post data on success, WP_Error on failure.

Source

function _wp_get_allowed_postdata( $post_data = null ) {	if ( empty( $post_data ) ) {	$post_data = $_POST;	}	// Pass through errors.	if ( is_wp_error( $post_data ) ) {	return $post_data;	}	return array_diff_key( $post_data, array_flip( array( 'meta_input', 'file', 'guid' ) ) ); } 

Changelog

VersionDescription
5.0.1Introduced.

User Contributed Notes

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