_wp_get_allowed_postdata

函数


_wp_get_allowed_postdata ( $post_data = null )
参数
  • (array|WP_Error|null)
    $post_data
    The array of post data to process, or an error object. Defaults to the `$_POST` superglobal.
    Required:
    Default: null
返回值
  • (array|WP_Error) Array of post data on success, WP_Error on failure.
定义位置
  • wp-admin/includes/post.php
    , line 216
引入
5.0.1
弃用

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' ) ) );
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。