WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#38679 closed defect (bug) (fixed)

REST API: Media `caption` and `description` should have rendered/raw properties

Reported by: jnylen0 Owned by: rmccue
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch has-unit-tests
Focuses: Cc:
PR Number:

Description

Previously discussed at https://github.com/WP-API/WP-API/pull/2298, but I believe the decision there is incorrect: attachments have a post page just like posts, and wpautop and other rendering filters are applied on this page. So we need to handle "content" (description) and "excerpt" (caption) the same way for attachments.

Props @miyauchi for getting this patch started.

Attachments (1)

38679.diff (10.1 KB) - added by jnylen0 3 years ago.

Download all attachments as: .zip

Change History (7)

@jnylen0
3 years ago

#1 @swissspidy
3 years ago

  • Keywords has-patch has-unit-tests added

#2 @jnylen0
3 years ago

Also relevant here: https://core.trac.wordpress.org/ticket/38609#comment:9

[With this patch], the rendered description for media items includes the <p class="attachment"> tag containing the attachment content itself. Perhaps the filters we apply to attachment description should be tweaked, and this should show up in the content property instead?

This ticket was mentioned in Slack in #core-restapi by jnylen. View the logs.


3 years ago

#4 @rmccue
3 years ago

  • Milestone changed from Awaiting Review to 4.7
  • Owner set to rmccue
  • Status changed from new to assigned

#5 @rmccue
3 years ago

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

In 39154:

REST API: Change attachment caption & description to objects.

Just like excerpt and content for regular posts, these have transformations applied that can make the content significantly different from the raw value.

Props jnylen0.
Fixes #38679.

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


3 years ago

Note: See TracTickets for help on using tickets.