1

Normally when using a rich text editor, when you hit return (i.e. do a full paragraph return) Your text is wrapped i.e. <p> my text </p> however this does not happen in wordpress.

Is there any way to trigger this functionality?

1 Answer 1

3

This happens at the time the content is output the browser. At that point, the content is passed through several filters, one of which is called wpautop. This filter function is defined in wp-includes/formatting.php. In combination with the other default WordPress filters, this generally means that you can compose content in the HTML (non-wysiwyg) editor as if you were writing plain text, and it will format the final HTML output in a logical, intuitive manner.

On the other hand, you can also feel free to manually compose HTML tags in your output, and WP will preserve your tags. There are some edge-cases that can get you sometimes (using non-standard tags or attributes), but for the most part, the editor and the filters are pretty smart.

1
  • yes - apparently the get_the_content function does not filter the content using wpautop I had to do: apply_filters('the_content', get_the_content());
    – Mazatec
    Jun 30, 2011 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.