WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 4 months ago

Last modified 5 days ago

#40040 closed enhancement (fixed)

Run wpautop on author bio

Reported by: henry.wright Owned by: johnbillion
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.7
Component: Formatting Keywords: needs-unit-tests has-patch
Focuses: template Cc:

Description

The wpautop function replaces double line-breaks with paragraph elements. It's executed on various items of content. Post content and term descriptions (used in category descriptions) are some examples.

I believe the author bio would benefit from wpautop.

Attachments (4)

Screenshot 2017-03-06 at 02.19.23.png (7.2 KB) - added by henry.wright 9 months ago.
40040.diff (606 bytes) - added by henry.wright 9 months ago.
40040.1.diff (2.5 KB) - added by henry.wright 5 months ago.
40040.2.diff (2.4 KB) - added by henry.wright 5 months ago.
get_the_post_type_description() seems a more appropriate name than get_the_post_type_archive_description(). 40040.2.diff changes the name of the new function.

Download all attachments as: .zip

Change History (29)

@henry.wright
9 months ago

#1 @henry.wright
9 months ago

  • Keywords has-patch added

40040.diff runs wptexturize, convert_chars, wpautop and shortcode_unautop on the author description field.

This ticket was mentioned in Slack in #core by henrywright. View the logs.


9 months ago

This ticket was mentioned in Slack in #core by henrywright. View the logs.


8 months ago

#4 @johnbillion
8 months ago

  • Focuses template added
  • Version changed from 4.7.2 to 4.7

Pending some testing by Henry as discussed at Open Source Sprint London.

#5 @henry.wright
8 months ago

  • Focuses template removed
  • Keywords dev-feedback added
  • Version changed from 4.7 to 4.7.2

Using the_archive_description() in archive.php will output:

  • a term description if the current page is example.com/category/slug (or example.com/tag/slug for example)
  • an author's bio if the current page is example.com/author/username

Support for author bio was added in 4.7.0.

The reason for this ticket is the output of the_archive_description() is now inconsistent.

The term description is run through 4 functions:

  • wptexturize
  • convert_chars
  • wpautop
  • shortcode_unautop

However, the author bio isn't run through these.

This results in the front end source code looking like this:

In example.com/category/slug:

<p>This is a term description &#038; convert_chars and wpautop have run on it</p>

In example.com/author/username:

This is an author bio & convert_chars and wpautop have not run on it

40040.diff will make the category, tag and author archive output of the_author_description() consistent.

Running the_author_description() through one of the 4 functions manually didn't change the output so if end-users are doing this nothing will change for them after the introduction of this patch.

  • wptexturize( the_author_description() )
  • convert_chars( the_author_description() )
  • wpautop( the_author_description() )
  • shortcode_unautop( the_author_description() )

#6 @johnbillion
8 months ago

  • Focuses template added
  • Version changed from 4.7.2 to 4.7

This ticket was mentioned in Slack in #core by henrywright. View the logs.


7 months ago

This ticket was mentioned in Slack in #core by henrywright. View the logs.


7 months ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 months ago

#10 @henry.wright
5 months ago

  • Keywords dev-feedback removed

#11 @johnbillion
5 months ago

  • Component changed from General to Formatting
  • Milestone changed from Awaiting Review to 4.9

#12 @johnbillion
5 months ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 41172:

Formatting: Add formatting and texturization to author descriptions so they match the formatting of term descriptions.

Props henry.wright

Fixes #40040

#13 @johnbillion
5 months ago

  • Keywords needs-unit-tests added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Pro tip for testing locally: Run the tests against the correct installation.

This broke Tests_User_Author_Template::test_get_the_author_meta()

#14 follow-up: @johnbillion
5 months ago

@henry.wright since #38487, a post type archive description cane be output by the_archive_description() too, but it also lacks wpautop() etc. Wanna knock up a patch?

I'll look at fixing the test mentioned above.

#15 @johnbillion
5 months ago

In 41173:

Formatting: Update the author description tests since the formatting change made in [41172].

See #40040

#16 in reply to: ↑ 14 @henry.wright
5 months ago

  • Keywords has-patch added

Replying to johnbillion:

@henry.wright since #38487, a post type archive description cane be output by the_archive_description() too, but it also lacks wpautop() etc. Wanna knock up a patch?

Sure! 40040.1.diff is my stab at it. I first created a function to get the post type archive description and make that description filterable. I then used the new filter in default-filters.php.

@henry.wright
5 months ago

get_the_post_type_description() seems a more appropriate name than get_the_post_type_archive_description(). 40040.2.diff changes the name of the new function.

#17 @johnbillion
5 months ago

  • Status changed from reopened to reviewing

#18 @johnbillion
4 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41232:

Formatting: Introduce get_the_post_type_description() to allow post type archive descriptions to be formatted the same as author and term archives.

Props henry.wright

Fixes #40040

#19 @afercia
4 weeks ago

Has this been mentioned in a dev notes blog post or elsewhere? Though minor, it's a breaking change and authors should have been informed. For a first report, see #42578.

#20 @Ov3rfly
4 weeks ago

More reports will probably follow for Twenty Sixteen 1.4, Twenty Fifteen 1.9, Twenty Thirteen 2.3, Twenty Twelve 2.4, Jetpack 5.5, etc.

Last edited 4 weeks ago by Ov3rfly (previous) (diff)

#21 @mrahmadawais
4 weeks ago

OK, this wpautop has broken so many themes. It has started inserting p tags on the Author bio which are not styled.

#22 @henry.wright
4 weeks ago

@johnbillion what are your thoughts? Themes must be supporting <p> tags in term descriptions but it seems they're often not supporting them in the author description.

#23 @rabmalin
4 weeks ago

Strange that this breaking change went to the core so silently. Even default themes have not been updated to fix this. Eg, in Twenty Twelve, there is <p><?php the_author_meta( 'description' ); ?></p>

#24 @johnbillion
2 weeks ago

Follow-up to revert this change: #42578

This ticket was mentioned in Slack in #forums by zoonini. View the logs.


5 days ago

Note: See TracTickets for help on using tickets.