Opened 11 years ago
Closed 11 years ago
#34043 closed enhancement (fixed)
wp_check_for_changed_slugs() ignores attachments
| Reported by: | swissspidy | Owned by: | pento |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Posts, Post Types | Version: | 2.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
11 years ago
- Keywords has-patch added; needs-patch needs-unit-tests removed
- Milestone Awaiting Review → 4.4
#3
follow-up:
↓ 4
@
11 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].
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.