Remove Line Breaks in WordPress
<?php | |
/** | |
* Apply new wpautop filter to Press Release content | |
*/ | |
function km_filter_press_release_content() { | |
if ( ! is_singular( 'press-releases' ) ) { | |
return; | |
} | |
remove_filter( 'the_content', 'wpautop' ); | |
add_filter( 'the_content', 'km_remove_wpautop_line_breaks' ); | |
} | |
add_action( 'wp', 'km_filter_press_release_content' ); | |
/** | |
* Apply wpautop() to content and remove line breaks | |
* | |
* @param string $content the_content(). | |
* @return string the_content() with line breaks removed. | |
*/ | |
function km_remove_wpautop_line_breaks( $content ) { | |
return wpautop( $content, false ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment