[wp-trac] [WordPress Trac] #44394: Error when trying to get the columns of a three-columns gallery.
WordPress Trac
noreply at wordpress.org
Mon Jun 18 12:19:40 UTC 2018
#44394: Error when trying to get the columns of a three-columns gallery.
--------------------------+---------------------------------------
Reporter: virginthumb | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Gallery | Version:
Severity: minor | Keywords: needs-patch needs-testing
Focuses: |
--------------------------+---------------------------------------
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
<?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>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44394>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list