Opened 9 years ago
Closed 9 years ago
#34043 closed enhancement (fixed)
wp_check_for_changed_slugs() ignores attachments
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 2.1 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | Cc: |
Description
While working on #33920 I noticed that wp_check_for_changed_slugs()
only works for published, non-hierarchical posts.
However, I think it should also store the changed slug for attachments (post status 'inherit'
). Currently, when you change the slug of an attachment and visit its old URL, you get a 404 error.
When implementing this we could enhance the unit tests #33920 introduces and also add tests for the wp_check_for_changed_slugs
function itself beforehand.
Attachments (2)
Change History (7)
#1
@
9 years ago
- Keywords has-patch added; needs-patch needs-unit-tests removed
- Milestone changed from Awaiting Review to 4.4
#3
follow-up:
↓ 4
@
9 years ago
- Keywords needs-refresh removed
Thanks! I just updated the patch now. You're right, the check should be more strict.
I'm also pondering if, when changing the slug on a post, the slug on attachments should change, too. I'm open to arguments either way.
Can you elaborate on this? Accessing an attachment URL with a wrong post slug in it was handled by [34272].
inherit
, I think thein_array($post->post_status, array( 'publish', 'inherit' ) )
check needs to be stricter, and only allow attachments with that post_status.I'm also pondering if, when changing the slug on a post, the slug on attachments should change, too. I'm open to arguments either way.