首页 WordPress函数大全 sanitize_post_field()

sanitize_post_field()

2020-05-02 / 3090阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

sanitize_post_field( string $field, mixed $value, int $post_id, string $context = 'display' )

清理基于字段的帖子>

Contents

  • Description
    • Parameters
    • Return
    • Source
    • Changelog
  • More Information
  • Related
    • Uses
    • Used By
  • User Contributed Notes

描述

可能的上下文值是:“ raw”,“ edit”,“ db”,“ display”,“ attribute”和“ js”。默认情况下使用“显示”上下文。调用过滤器时,“属性”和“ js”上下文被视为“显示”。

参数

$field

(string)
(Required)
The Post Object field name.

$value

(mixed)
(Required)
The Post Object value.

$post_id

(int)
(Required)
Post ID.

$context

(string)
(Optional)
How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display', 'attribute' and 'js'.

Default value: 'display'

返回

(mixed) Sanitized value.

大家谈论
    我的见解