[wp-trac] [WordPress Trac] #11023: Gallery Category Doesn't change with article

WordPress Trac noreply at wordpress.org
Tue Jul 12 15:05:01 UTC 2022

#11023: Gallery Category Doesn't change with article
 Reporter:  mrgtb         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Gallery       |     Version:
 Severity:  normal        |  Resolution:  worksforme
 Keywords:  has-patch     |     Focuses:
Changes (by desrosj):

 * keywords:  has-patch needs-testing dev-feedback => has-patch
 * status:  new => closed
 * resolution:   => worksforme


 It's been quite a while for this one.

 I've done some testing and I think this can be closed out based on my

 Replying to [comment:1 dd32]:
 > I believe this might be because uploads will ALWAYS recieve the default
 category, And never inherit the parents categories unless a plugin is
 used.. Just as you cant assign categories to uploads directly.

 This doesn't seem to be the case anymore. Uploading an attachment to the
 media library (unattached) and having `%category%/%postname%` as the
 permalink structure results in a `site.com/attachment-slug` URL.

 > I do however agree, If an attachment is attached to a post, and
 %category% is used within the permalink, it should be that of the parent.

 This now appears to be the default behavior.

 To test:
 - Set custom permalink structure to anything using `%category%`. I used
 - Created a new category "Drafts"
 - Set the new category as the default.
 - Created a new post.
 - Inserted an image block and a gallery block and upload new images to
 - Changed both to link to the attachment page for the images.
 - Published.
 - The attachment page permalinks are `/drafts/post-name/attachment
 - Change the parent post's category to Uncategorized (remove Drafts).
 - The attachment page permalinks become `/uncategorized/post-

 Tested with both classic and block editors.

Ticket URL: <https://core.trac.wordpress.org/ticket/11023#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list