summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/class.jetpack-post-images.php')
-rw-r--r--plugins/jetpack/class.jetpack-post-images.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/jetpack/class.jetpack-post-images.php b/plugins/jetpack/class.jetpack-post-images.php
index b79bd8f1..c40889f0 100644
--- a/plugins/jetpack/class.jetpack-post-images.php
+++ b/plugins/jetpack/class.jetpack-post-images.php
@@ -102,7 +102,17 @@ class Jetpack_PostImages {
$permalink = get_permalink( $post->ID );
+ /**
+ * Juggle global post object because the gallery shortcode uses the
+ * global object.
+ *
+ * See core ticket:
+ * https://core.trac.wordpress.org/ticket/39304
+ */
+ $juggle_post = $GLOBALS['post'];
+ $GLOBALS['post'] = $post;
$galleries = get_post_galleries( $post->ID, false );
+ $GLOBALS['post'] = $juggle_post;
foreach ( $galleries as $gallery ) {
if ( isset( $gallery['type'] ) && 'slideshow' === $gallery['type'] && ! empty( $gallery['ids'] ) ) {