WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#8991 closed defect (bug) (fixed)

get_posts() fails to retrieve attachments with mime type like (type/sub+suffix)

Reported by: Sam_a Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Media Keywords: has-patch
Focuses: Cc:

Description

get_posts() and related functions can't retrieve attachments whose post_mime_type field has a valid compound subtype like atom+xml, xspf+xml, & c.

A fix is to add the plus character + to the $mime_subgroup expression in wp_post_mime_type_where().

Attachments (1)

wp_post_mime_type_where_suffix.diff (623 bytes) - added by Sam_a 5 years ago.
Fixes wp_post_mime_type_where() so it works correctly for mime types like (type/sub+suffix)

Download all attachments as: .zip

Change History (4)

Sam_a5 years ago

Fixes wp_post_mime_type_where() so it works correctly for mime types like (type/sub+suffix)

comment:1 Sam_a5 years ago

  • Keywords has-patch added

Patch works for me in revision 10347.

Without the patch, wp_post_mime_type_where() strips the + and returns, e.g., (post_mime_type = 'application/atomxml'), which won't match anything.

comment:2 Sam_a5 years ago

  • Version set to 2.7

comment:3 ryan5 years ago

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

(In [10502]) Allow + in mime type regex. Props Sam_a. fixes #8991

Note: See TracTickets for help on using tickets.