Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent pages REST API call poses a serious performance issue #17160

Closed
kmgalanakis opened this issue Aug 23, 2019 · 2 comments
Closed

Parent pages REST API call poses a serious performance issue #17160

kmgalanakis opened this issue Aug 23, 2019 · 2 comments

Comments

@kmgalanakis
Copy link

Describe the bug
When the editor loads for a new page, a REST API request is made to fetch the possible parent posts in order to populate the relevant dropdown.

http://my-server.test/wp-json/wp/v2/pages?per_page=100&exclude=2&parent_exclude=2&orderby=menu_order&order=asc&context=edit&_locale=user

What this dropdown need is only the post ID and the post title. What actually happens is that for each of the possible parent posts retrieved, a full post object (with edit context) is returned, which causes all the relevant filters to be applied.

To reproduce
Steps to reproduce the behavior:

  1. Create a simple filter hooked on the the_content.
  2. Create a new page and notice how many times the filter callback is triggered.

Expected behavior
The filter callback is triggered as many times as the number of possible parent posts retrieved by this REST API call.

I know that the maximum number of posts that this filter will be applied is 100 and in most sites, there are even less than 100 posts available, but again this behavior is something that could be avoided.

@youknowriad
Copy link
Contributor

I agree, that's a concern. This issue is a duplicate of #13618 though.

@kmgalanakis
Copy link
Author

Thanks @youknowriad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants