WordPress开发者和主题制作者的搜索引擎



_wp_get_allowed_postdata ›

Since5.0.1
已弃用n/a
_wp_get_allowed_postdata ( $post_data = null )
参数:
  • (array) $post_data Array of post data. Defaults to the contents of $_POST.
    Required: No
    默认: null
返回:
  • (object|bool) WP_Error on failure, true on success.
定义在:
文档:

Returns only allowed post data fields



源码

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' ) ) );
}