• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

関数リファレンス/wp kses

提供: WordPress Codex 日本語版
移動先: 案内検索

Description

This function makes sure that only the allowed HTML element names, attribute names and attribute values plus only sane HTML entities will occur in $string. You have to remove any slashes from PHP's magic quotes before you call this function.

Usage

<?php wp_kses( $string, $allowed_html, $allowed_protocols ); ?>

Parameters

$string
string) (必須) Content to filter through kses
初期値: なし
$allowed_html
array) (必須) List of allowed HTML elements
初期値: なし
$allowed_protocols
array) (optional) Allow links in $string to these protocols.
初期値: The default allowed protocols are http, https, ftp, mailto, news, irc, gopher, nntp, feed, and telnet. This covers all common link protocols, except for javascript, which should not be allowed for untrusted users.

Return

(string) 
Filtered string of HTML.

Examples

Allowed HTML Tags Array

This is an example of how to format an array of allowed HTML tags and attributes.

array(
    'a' => array(
        'href' => array(),
        'title' => array()
    ),
    'br' => array(),
    'em' => array(),
    'strong' => array(),
);

Notes

  • KSES is a recursive acronym which stands for “KSES Strips Evil Scripts".

Change Log

  • Since: 1.0.0

Source File

wp_kses() is located in wp-includes/kses.php.

Related

See: Data Validation article for an in-depth discussion of input and output sanitization.


関数リファレンステンプレートタグ目次もご覧ください。


最新英語版: WordPress Codex » Function Reference/wp_kses最新版との差分