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 tried many things to solve this problem.

So I have a plugin which displays projects assigned to users in a widget. It displays projects as posts. The problem is that it only displays 5 projects on the page.

I am sending a code which display posts:

$projects = get_posts(array('post_type' => 'projects'));

One guy told me to change it to

$projects = get_posts(array('post_type' => 'projects', 'number posts' => 10));

which should help but it didnt.

Anyone have idea how to solve it ? I can send whole code if it's needed.

share|improve this question
up vote 2 down vote accepted

The WordPress function get_posts() supports:

'posts_per_page'  => 10,
'numberposts'     => 10,

so you should use:

$projects = get_posts(array('post_type' => 'projects', 'numberposts' => 10));

instead of

$projects = get_posts(array('post_type' => 'projects', 'number posts' => 10));

If you want to show all posts, you can use

'posts_per_page'  => -1

You can read more about this in the WordPress Codex:


share|improve this answer
Damn one space made a difference.. MAny thanks for help, its working perfect !:) Thanks and best regards, Arek K. – Arkadiusz Kwiatkowski Apr 29 '13 at 8:36
That happens to the best of us ;-) – birgire Apr 29 '13 at 8:37

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.