Title: getEntityRecords performance issues
Last modified: April 25, 2020

---

# getEntityRecords performance issues

 *  [DaveWP196](https://wordpress.org/support/users/davewp196/)
 * (@davewp196)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/getentityrecords-performance-issues/)
 * There is a sever performance issue associated with using getEntityRecords in 
   that triggers the content of the entire website to be downloaded as a response.
 * Is it possible to specify the fields to be returned when making the getEntityRecords?
   As things stand, the following code results in the content and excerpts of every
   page being downloaded including the processing of all shortcodes.
 *     ```
           edit: withSelect( ( select, props ) => {
               PROPS=props;
               return {
                   posts: select( 'core' ).getEntityRecords( 'postType', 'page', {per_page:-1, order:'asc', orderby:'title'} ),
               };
       ```
   
 * Are there filters I can set on the server to control what fields are returned?
   It appears Gutenberg editor is always generating a REST API request of the form“
   wp-json/wp/v2/pages?per_page=100&exclude=<page>&parent_exclude=<page>&orderby
   =menu_order&order=asc&context=edit&_locale=user”
 * Finally, I am not sure of the rationale of including all page content by default
   when just requesting a list of pages, I would have expected there should be an
   mechanism to specify the fields to be returned when making the getEntityRecords
   requests. In making this observation I am aware that this will affect both the
   Gutenberg Block Editor functionality and WordPress REST API.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fgetentityrecords-performance-issues%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [corrinarusso](https://wordpress.org/support/users/corrinarusso/)
 * (@corrinarusso)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/getentityrecords-performance-issues/#post-12744875)
 * [@davewp196](https://wordpress.org/support/users/davewp196/)
 * Do you have to register the field in your functions file before it can be used
   in the API ?
 * Perhaps it would be better to retrieve the fields through Ajax :
    [https://developer.wordpress.org/reference/functions/wp_localize_script/](https://developer.wordpress.org/reference/functions/wp_localize_script/)
 * Here’s an article from a LoDash implementation :
    [https://wpdev.life/using-withselect-for-wordpress-block-components/](https://wpdev.life/using-withselect-for-wordpress-block-components/)

Viewing 1 replies (of 1 total)

The topic ‘getEntityRecords performance issues’ is closed to new replies.

## Tags

 * [editor](https://wordpress.org/support/topic-tag/editor/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [corrinarusso](https://wordpress.org/support/users/corrinarusso/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/getentityrecords-performance-issues/#post-12744875)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
