admin管理员组

文章数量:1386798

I am trying to query data in gutenberg like search in REST API. Following this documentation:

/

I came up with this select:

wp.data.select("core").getEntityRecords("postType", "page", {
  status: ["publish", "draft"],
  per_page: 10,
  search: "",
});

It suffers just one problem. It allows me query always only single post type but I need query both types - 'post' and 'page'. Altering select as follow does not work:

wp.data.select("core").getEntityRecords("postType", ["page", "post"], {
  status: ["publish", "draft"],
  per_page: 10,
  search: "",
});

So how is it possible to query data in Gutenberg to get result like common search functionality has?

本文标签: javascriptGutenberg get core datasearch