Opened 11 years ago
Closed 6 years ago
#31947 closed enhancement (wontfix)
Allow developers to enable $br in wpautop() using a filter
| Reported by: | | Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.2 |
| Component: | Formatting | Keywords: | |
| Focuses: | Cc: |
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
@
10 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
@
6 years ago
- Resolution set to wontfix
- Status changed from new to 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.
Adds wpautop_br filter in wpautop() in src/wp-includes/formatting.php.