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

Permit unbounded per_page=-1 requests for Categories and Tags #6722

Merged
merged 3 commits into from
May 15, 2018

Conversation

danielbachhuber
Copy link
Member

@danielbachhuber danielbachhuber commented May 11, 2018

Description

Permits requests of per_page=-1 to /wp/v2/categories and /wp/v2/tags in order to fetch all available items; updates corresponding Gutenberg components to fetch all items.

Fixes #5820
Fixes #4022
Related #6627 #6657
See #6180 (comment)

How has this been tested?

I generated 200 categories with:

wp term generate category --count=200

When I access the category selection UI, I see all 200 categories:

image

Similarly, when I insert a category block, I see all categories:

image

It also works with a custom taxonomy:

add_action( 'init', function(){
	register_taxonomy( 'section', array( 'post' ), array(
		'hierarchical' => true,
		'show_in_rest' => true,
		'rest_base'    => 'sections',
	));
});

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@danielbachhuber danielbachhuber added this to the 2.9 milestone May 11, 2018
@danielbachhuber
Copy link
Member Author

Going ahead and landing this. Happy to own any follow-up issues that come up.

@danielbachhuber danielbachhuber merged commit 0f74b95 into master May 15, 2018
@danielbachhuber danielbachhuber deleted the 5820-term-unbounded-queries branch May 15, 2018 17:26
@tofumatt
Copy link
Member

I am away on holiday (in Japan, trying not to do too much work 😅) this week and next so couldn’t review, sorry about that.

Is it usual to land un-reviewed PRs? Doesn’t seem like this was sitting here that long. It is dangerous to land unreviewed code; little mistakes happen and peer review often catches them.

@tofumatt
Copy link
Member

FWIW the code seems similar to other patches around this and is fine (with all the existing caveats about unbounded results, etc).

But I don’t think we should be landing unreviewed code.

@danielbachhuber
Copy link
Member Author

Is it usual to land un-reviewed PRs?

Nope. I needed to be able to move on to #6761 though.

It is dangerous to land unreviewed code; little mistakes happen and peer review often catches them.

I agree. I'm willing to own any post-merge code review in a follow-up PR.

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

Successfully merging this pull request may close these issues.

2 participants