Make WordPress Core

Opened 8 years ago

Last modified 6 years ago

#37157 new defect (bug)

Photo galleries are displaying EVERY photo in library (and related issues).

Reported by: webtechmailbag's profile webtechmailbag Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.2
Component: Gallery Keywords:
Focuses: Cc:

Description

ISSUE 1.)

  • With WordPress Permalinks set to "Post Name", any photo gallery that has been added to a page displays EVERY photo in the media library.

For example if you've added a gallery of 3 photos, 3 thumbnails are displayed on the page, but entering the gallery will allow you to click "next" to view every photo that has been uploaded to the WordPress site.

This has been tested in a fresh install of WordPress (version 4.5.3) and with the themes Twenty Thirteen through Twenty Sixteen.

In this case WordPress Permalink settings have been set to "Post Name". If Permalinks are instead set to "Plain" (the default) this does not seem to be a problem. I have not tested out other Permalink settings to see if they work.

An internet search brings up two discussions related to this issue which do not appear to have been properly resolved:

ISSUE 2.)

  • Single photos added to a page are no longer viewable within a gallery.

If you've added a single photo (not a gallery) to a page that also contains a gallery, and if that single photo is also part of the gallery's thumbnail group, it is longer a part of the actually gallery. You can no longer view that image by entering the gallery even though it is shown in the gallery's thumbnails.

In this case the single photo is set to "link to attachment page". Permalinks are set to "Post Name".

ISSUE 3.)

  • Single photos added to a page have incorrect attachment link by default. In this case Permalinks are set to "Post Name".

If you add a single photo to a page and leave the default "link to attachment page" set, the link is incorrect; it is missing the page name in it's path. If you then go back to edit the page again and look at the details of the photo, you can see that it has changed to "link to custom URL" but is still showing the same incorrect link. Changing this back again to "link to attachment page" corrects the link by adding the page name to the path.

I have not tested this with other Permalink settings.

ISSUE 4.)

There seems to be a problem with galleries not displaying all photos when certain other pages are in the "trash".

For example, after deleting a page titled "try" which contained the image "cake", another page would not display "cake" within a photo gallery.

Clicking on the "cake" thumbnail in the photo galley opened the attachment page "trytrashed/cake/" and would not slide to the next photo. Clicking on any of the other thumbnails in the gallery would work, but would never slide to "cake".

Change History (2)

#1 @webtechmailbag
8 years ago

IMPORTANT:

ISSUE 1.) It looks like this is a problem no matter how Permalinks are set. I'm noticing the same issue, (galleries allow viewing of EVERY photo uploaded to WordPress) even if Permalinks are set to "Plain", or "Day and Name", or "Post name". Setting to "Plain" does not seem to help as I indicated earlier. (Testing on fresh install with Twenty Sixteen.)

(Small correction: I earlier referred to "plain" as being the default Permalink setting, when "day and name" is actually the default.)

Last edited 8 years ago by webtechmailbag (previous) (diff)

#2 @webtechmailbag
8 years ago

PINPOINTING THE PROBLEM CODE:

ISSUE 1.) Further testing shows that if instead of adding a gallery you add a bunch of individual photos to a page, the attachment page behaves properly: viewing a photo attachment allows you click "next" to cycle through all, and ONLY, the photos that are included on that page.

Maybe this can help in determining where the problem code is.

ISSUE 3.) Adding individual photos is still generating incorrect links until you go back second time to fix them, as described.

Note: See TracTickets for help on using tickets.