On this page
kses_init_filters()
Adds all KSES input form content filters.
Description
All hooks have default priority. The wp_filter_kses() function is added to the ‘pre_comment_content’ and ‘title_save_pre’ hooks.
The wp_filter_post_kses() function is added to the ‘content_save_pre’, ‘excerpt_save_pre’, and ‘content_filtered_save_pre’ hooks.
Source
File: wp-includes/kses.php. View all references
function kses_init_filters() {
// Normal filtering.
add_filter( 'title_save_pre', 'wp_filter_kses' );
// Comment filtering.
if ( current_user_can( 'unfiltered_html' ) ) {
add_filter( 'pre_comment_content', 'wp_filter_post_kses' );
} else {
add_filter( 'pre_comment_content', 'wp_filter_kses' );
}
// Global Styles filtering: Global Styles filters should be executed before normal post_kses HTML filters.
add_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
add_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );
// Post filtering.
add_filter( 'content_save_pre', 'wp_filter_post_kses' );
add_filter( 'excerpt_save_pre', 'wp_filter_post_kses' );
add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
}
Related
Uses
| Uses | Description |
|---|---|
| current_user_can() wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| add_filter() wp-includes/plugin.php | Adds a callback function to a filter hook. |
Used By
| Used By | Description |
|---|---|
| wp_handle_comment_submission() wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| wp_ajax_replyto_comment() wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| kses_init() wp-includes/kses.php | Sets up most of the KSES filters for input form content. |
| WP_Embed::shortcode() wp-includes/class-wp-embed.php | The do_shortcode() callback function. |
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/kses_init_filters