WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a page and added a media gallery to it, but the media gallery doesn't display.

I think it may be related to my using WP Read-Only, which stores all my images on S3 (because I'm on Heroku). WP-Read Only doesn't run into any identifiable issues-- I can upload and crop just fine. So maybe it's not the cause of the media gallery not showing.

Here's the shortcode output: [gallery ids="54,55"]

Here's the HTML in the content div on the media page:

<div id="content" role="main">                  
    <article id="post-29" class="post-29 page type-page status-publish hentry">
        <header class="entry-header">
            <h1 class="entry-title">Media</h1>

        <div class="entry-content">

                    </div><!-- .entry-content -->
        <footer class="entry-meta">
                    </footer><!-- .entry-meta -->
    </article><!-- #post -->

   <div id="comments" class="comments-area">                            
   </div><!-- #comments .comments-area -->          

I'm using WordPress 3.5.2. The only plugin other than WP Read-Only I have installed is Akismet.

Update: I dug into the gallery_shortcode function in wp_includes/media.php, and the issue is that get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); is returning an empty array so it returns nothing:

if ( empty($attachments) )
    return '';
share|improve this question
What's the shortcode output? – gmazzap Jul 30 '13 at 19:01
(added to question) (also added the html it produces) – babonk Jul 30 '13 at 19:06
So gallery shortcode produce nothing. afaik this happens only in 2 cases: when there is function that hooks into 'post_gallery' filter and output something != '' but not visible (like a blank space) but this is a rarely case or, more frequently, when the query for attachments fails. Query is something like get_posts(array('include'=>'50,55', 'post_status'=>'inherit','post_type'=>'attachment','post_mime_type'=>'image') can you find something that can make it fails on your wp installation? – gmazzap Jul 30 '13 at 20:31
Sorry what do you want me to do? – babonk Jul 30 '13 at 22:51
up vote 0 down vote accepted

Found the issue. I'm using Postgres_SQL cus I'm on Heroku, but that doesn't play nicely with Wordpress. Here's the problem query:

SELECT wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (8,9)...

It caused the error described here: http://stackoverflow.com/a/14132471/378622

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.