当前浏览:首页 / WordPress函数 / sanitize_option()

sanitize_option( string $option, string $value )

根据选项的性质清理各种选项值

kses 清理

option 选项more...

sanitize 清理more...


描述

这基本上是一个switch语句,它将根据$option通过多个函数传递$value。


参数

$option

(string) (必填) 选项的名称。

$value

(string) (必填) 未初始化的值。


返回

(string) 净化清理后的值


说明

在switch语句中的函数处理完值后,它将通过sanitize_option_$option过滤器。

可以通过添加适当的sanitize_option_$option过滤器来定义新选项(例如,针对“avatar”选项的过滤器的“sanitize_option_avatar”)

sanitize_option()处理的现有选项:

admin_email
new_admin_email
thumbnail_size_w
thumbnail_size_h
medium_size_w
medium_size_h
large_size_w
large_size_h
mailserver_port
comment_max_links
page_on_front
page_for_posts
rss_excerpt_length
default_category
default_email_category
default_link_category
close_comments_days_old
comments_per_page
thread_comments_depth
users_can_register
start_of_week
posts_per_page
posts_per_rss
default_ping_status
default_comment_status
blogdescription
blogname
blog_charset
blog_public
date_format
time_format
mailserver_url
mailserver_login
mailserver_pass
upload_path
ping_sites
gmt_offset
siteurl
home
WPLANG
illegal_names
limited_email_domains
banned_email_domains
timezone_string
permalink_structure
category_base
tag_base



源码

查看源码 官方文档


更新日志

版本描述
2.0.5开始引入