preg_replace and comment_form_defaults
this was kinda of a joke at the beginning but now I'm wondering if it's possible to use regex with the hook comment_form_defaults. Here is what I'm looking for :
function remove_default_allowed_tags( $defaults) {
$defaults = preg_replace('/p class="form-allowed-tags"(.*?)\/p/','', $defaults);
return $defaults;
}
add_filter('comment_form_defaults', 'remove_default_allowed_tags', 2);
I know it can be easily done with something like this :
$defaults['comment_notes_after'] = ''; return $defaults;
But I just want to know if I can use my regex in this context and if not, why. Thanks for your answer(s).
Topic allowedtags regex Wordpress
Category Web