Disable formatting on textarea
I'm using the following code in my plugin to display a textarea
field on a page:
echo 'textarea required="required" name="Message" class="textarea" cols="70" rows="10"'.esc_textarea($message).'/textarea';
However, WordPress seems to be inserting p
and br /
tags into the textarea contents if the message contains newline characters. I'm assuming this is being caused by the default wpautop() filter.
Is there a way to disable filtering of textarea
contents on a page?
Edit
Some more information about how my plugin works. It creates a hook for the_content
, which will append data to the contents of certain pages. I still want wpautop
formatting to be applied to the appended content, just not for the textarea
field.
Here is a rough outline of how my plugin is setup:
function get_special_content()
{
$text = '';
// Customized content is appended to text here
// including the textarea field
return $text;
}
function my_plugin_content_hook($content)
{
if(is_some_special_page()) {
return $content.get_special_content();
}
return $content;
}
add_action('the_content', 'my_plugin_content_hook');
Topic esc-textarea wp-autop Wordpress
Category Web