Skip to content

Commit 1e2a050

Browse files
committed
Add some category filters.
git-svn-id: https://develop.svn.wordpress.org/branches/2.0@3801 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 91dbad6 commit 1e2a050

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

wp-admin/admin-db.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ function wp_insert_category($catarr) {
9292
else
9393
$update = false;
9494

95-
$cat_name = wp_specialchars($cat_name);
96-
95+
$cat_name = apply_filters('pre_category_name', $cat_name);
96+
$category_nicename = apply_filters('pre_category_nicename', $category_nicename);
97+
$category_description = apply_filters('pre_category_description', $category_description);
98+
9799
if (empty ($category_nicename))
98100
$category_nicename = sanitize_title($cat_name);
99101
else
@@ -102,6 +104,7 @@ function wp_insert_category($catarr) {
102104
if (empty ($category_description))
103105
$category_description = '';
104106

107+
$category_parent = (int) $category_parent;
105108
if (empty ($category_parent))
106109
$category_parent = 0;
107110

wp-includes/default-filters.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949

5050
add_filter('comment_excerpt', 'convert_chars');
5151

52+
// Categories
53+
add_filter('pre_category_name', 'strip_tags');
54+
add_filter('pre_category_name', 'trim');
55+
add_filter('pre_category_name', 'wp_filter_kses');
56+
add_filter('pre_category_name', 'wp_specialchars', 30);
57+
add_filter('pre_category_description', 'wp_filter_kses');
58+
5259
// Places to balance tags on input
5360
add_filter('content_save_pre', 'balanceTags', 50);
5461
add_filter('excerpt_save_pre', 'balanceTags', 50);

0 commit comments

Comments
 (0)