WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.46k stars 4.18k forks source link

Method getEntityRecords always returns up to 10 records #13533

Closed PiotrSzlagura closed 5 years ago

PiotrSzlagura commented 5 years ago

Hello, I am trying to create custom gutenberg block with page selector.

I have following code:

edit: withSelect(select => ({
  posts: select("core").getEntityRecords(
    "postType",
    "page",
    {},
    { per_page: 100 }
  )
})

But even though I passed custom query params in last parameter, I still get only 10 pages. (I have about 15 pages available right now). How can I get all pages using withSelect?

youknowriad commented 5 years ago

I think it should be:

 posts: select("core").getEntityRecords(
    "postType",
    "page",
    { per_page: 100 }
  )

You have one extra argument in your function call.

PiotrSzlagura commented 5 years ago

You're right, thank you very much!