Opened 12 years ago
Closed 7 years ago
#31947 closed enhancement (wontfix)
Allow developers to enable $br in wpautop() using a filter
| Reported by: | KTOmega | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Formatting | Version: | 4.2 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
wpautop() can sometimes create unwanted <br/> tags in documents, where one is not needed or where a <p> is more appropriate. By adding the wpautop_br filter in wpautop, a theme developer can choose to force disable the $br argument:
apply_filters( 'wpautop_br', '__return_false' );
Attachments (1)
Change History (3)
#1
@
11 years ago
Hi, I support the requirement to disable br processing. My solution was to write a replacement filter function.
if ( !function_exists( "wpautop_nobr" ) ) {
function wpautop_nobr( $pee ) {
return( wpautop( $pee, false ) );
}
}
Then remove the wpautop filter function and replace it with one with the same or different priority.
remove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop_nobr', 99 );
Would this satisfy your needs?
With regards to your patch.
If would be more efficient to defer the filter processing until after testing $pee.
#2
@
7 years ago
- Resolution → wontfix
- Status new → closed
Given that simple nature of the workaround that @bobbingwide posted, and that this hasn't been a popular requested filter, I'm going to close this issue.
Should we see situations that aren't covered by workarounds, we can always revisit this.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Adds wpautop_br filter in wpautop() in src/wp-includes/formatting.php.