The specific function you are referring to is wpautop
, which adds paragraphs & HTML linebreaks to already intermixed HTML & plain text.
wpautop
is part of a family of content-processing functions hooked to the_content
, a filter applied to the post content after pulling from the database just before outputting. Taking a look at wp-includes/default-filters.php
, you can see the default functions are:
add_filter( 'the_content', 'wptexturize' );
add_filter( 'the_content', 'convert_smilies' );
add_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'shortcode_unautop' );
add_filter( 'the_content', 'prepend_attachment' );
add_filter( 'the_content', 'wp_make_content_images_responsive' );
You can remove them with remove_filter( 'the_content', 'name_of_function' )
, and add your own with add_filter( 'the_content', 'my_function' );
– see the documentation for more information on adding filters.