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 have noticed that if I have a query where posts_per_page are set to 4, any (image) gallery that belongs to one of those posts will too have only 4 items (although when I create the gallery from Add new post the gallery has 10 images).

How can I fix this?

share|improve this question

You need to post the query code of both the post query and the gallery query; no one can really make a guess otherwise.

You can try using <?php wp_reset_query(); ?> after the post query to force a reset.

See http://codex.wordpress.org/Function_Reference/wp_reset_query

share|improve this answer
But I don't really understand why a Gallery needs a query. After what may I reset the query? I would like every item in the gallery to appear, no matter there are 4 or 40 images in the gallery...Thanks – Alvaro Aug 15 '12 at 0:10
I'm just guessing at the problem; that's all I can do. You haven't posted code or anything to work with. – markratledge Aug 15 '12 at 4:17

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.