Opened 6 years ago
Last modified 6 years ago
#44394 new defect (bug)
Error when trying to get the columns of a three-columns gallery.
Reported by: | virginthumb | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.9.6 |
Component: | Gallery | Keywords: | needs-testing has-patch |
Focuses: | Cc: |
Description
It seems the get_post_gallery
function fails to retrieve the column count if it's 3.
First, create a gallery. Then, insert 2 or 3 or any number of images and set its column to 3.
Then, run this code in the context of a post (content.php / single.php will do):
<?php $gallery = get_post_gallery( $post->ID, False ); $gallery_images = explode( ',', $gallery['ids'] ); var_dump( $gallery['columns'] );
It will come out as:
<b>Notice</b>: Undefined index: columns in <b>C:\file.php</b> on line <b>45</b>
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Big update.
Turns out this bug only happens when there are 2 galleries. Removing the second gallery fixes it, but still,
get_post_gallery
should get the first / "featured" gallery only.