WP uses $allowedtags
to limit the set of allowable tags for comments.However, comments from administrators are unfiltered.
What’s the easiest way to ensure admin comments are also constrained to the tags contained in $allowedtags
?
WP uses $allowedtags
to limit the set of allowable tags for comments.However, comments from administrators are unfiltered.
What’s the easiest way to ensure admin comments are also constrained to the tags contained in $allowedtags
?
You must be logged in to post a comment.
kses_init
is hooked onto theinit
hook with default priority, and (after first removing any of the kses filters) adds filters which strip out tags (wp_filter_post_kses
for posts andwp_filter_kses
for comments) if the user does not have the capability ‘unfiltered_html’.Since the capability determines whether or not the user can post ‘unfiltered_html’ comments and posts – you probably don’t want to just remove that capability.
Instead, hook onto
init
, afterkses_init
, say with priority 20, and re-add the filters which strip out tags not in the$allowedtags
whitelist: