Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#40979 new defect (bug)

add_rewrite_endpoint() doesn't work when applied to unattached media

Reported by: henry.wright Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords: close
Focuses: Cc:


add_rewrite_endpoint( 'foo', EP_ATTACHMENT ); doesn't seem to be working for unattached media items. For example visiting the following returns a 404:


Change History (2)

#1 @dd32
5 years ago

  • Keywords close added

This makes sense to me as-is, although isn't what would be expected by some.

EP_ATTACHMENT applies to attachment rules only, these rules are for attached media only, ie. /2017/post-name/attachment-name/.
It does not apply to the page rules, which is how the unattached media is queried.

For reference, here's the rewrite rule hit:

url: /unattached-media/
regex: (.?.+?)(?:/([0-9]+))?/?$
query: pagename=unattached-media&page=

This is quite possibly a wontfix.

#2 @henry.wright
5 years ago

Agreed this makes sense as is if you consider unattached media to not be "attachments". I think the confusion arises because of the post_type.

Note: See TracTickets for help on using tickets.