wp_kses_hook

函式
wp_kses_hook ( $string, $allowed_html, $allowed_protocols )
引數
  • (string) $string Content to filter through KSES.
    Required:
  • (array[]|string) $allowed_html An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.
    Required:
  • (string[]) $allowed_protocols Array of allowed URL protocols.
    Required:
返回值
  • (string) Filtered content through {@see 'pre_kses'} hook.
定義位置
相關方法
wp_kses_postwp_kses_hairwp_kses_save_post_hookwp_kses_attr
引入
1.0.0
棄用
-

wp_kses_hook: 這個函式用來過濾wp_kses所允許使用的HTML標籤和屬性。

你在這裡新增任何KSES的鉤子。

目前只有一個KSES WordPress鉤子,{@see ‘pre_kses’},它在這裡被呼叫。
所有的引數都是傳遞給鉤子的,並期望收到一個字串。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) {
/**
* Filters content to be run through KSES.
*
* @since 2.3.0
*
* @param string $string Content to filter through KSES.
* @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
* or a context name such as 'post'. See wp_kses_allowed_html()
* for the list of accepted context names.
* @param string[] $allowed_protocols Array of allowed URL protocols.
*/
return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols );
}
function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) { /** * Filters content to be run through KSES. * * @since 2.3.0 * * @param string $string Content to filter through KSES. * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, * or a context name such as 'post'. See wp_kses_allowed_html() * for the list of accepted context names. * @param string[] $allowed_protocols Array of allowed URL protocols. */ return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols ); }
function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) {
	/**
	 * Filters content to be run through KSES.
	 *
	 * @since 2.3.0
	 *
	 * @param string         $string            Content to filter through KSES.
	 * @param array[]|string $allowed_html      An array of allowed HTML elements and attributes,
	 *                                          or a context name such as 'post'. See wp_kses_allowed_html()
	 *                                          for the list of accepted context names.
	 * @param string[]       $allowed_protocols Array of allowed URL protocols.
	 */
	return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols );
}

常見問題

FAQs
檢視更多 >