id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 39304,`get_post_galleries()` can return incorrect gallery items.,dd32,dd32,"`get_post_galleries()` is a little hacky in the way it works and doesn't work as intended when a plain `[gallery]` shortcode is within the content and the given post_id doesn't match the global `$post` object. For example, take the following scenario: {{{ post_content = [gallery] $GLOBALS['post'] = null; $data = get_post_galleries( $id ); }}} `$data` now contains a gallery of all ''unattached'' media, as the shortcode handler doesn't have the global `$post` context and instead queries for `post_parent = 0`. If the global `$post` was set to another post, the gallery would be of that posts media. ",defect (bug),closed,normal,4.7.3,Media,,normal,fixed,has-patch has-unit-tests,,