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

Taxonomies: Load all taxonomies #9635

Merged
merged 1 commit into from Sep 6, 2018
Merged

Conversation

youknowriad
Copy link
Contributor

closes #9589

By default the REST API requests load a limited chunk of records (pagination). This PR makes sure we load all the taxonomies.

Testing instructions

Register a bunch of taxonomies and test that they appear all.

add_action( 'init', 'loadtaxonomies' );

function loadtaxonomies() {
for ( $i = 1; $i <20; $i++) {
   register_taxonomy(
   	'genre'. $i,
   	'post',
   	array(
   		'label' => __( 'Genre' ),
   		'rewrite' => array( 'slug' => 'genre' ),
   		'hierarchical' => true,
   		'show_in_rest' => true
   	)
   );
}
}

@youknowriad youknowriad added the [Type] Bug An existing feature does not function as intended label Sep 5, 2018
@youknowriad youknowriad added this to the 3.8 milestone Sep 5, 2018
@youknowriad youknowriad self-assigned this Sep 5, 2018
@youknowriad youknowriad requested a review from a team September 5, 2018 16:34
Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An E2E test for this might be handy, but code makes sense.

Tested locally and it works 👍

@youknowriad youknowriad merged commit 8517779 into master Sep 6, 2018
@youknowriad youknowriad deleted the fix/load-all-taxonomies branch September 6, 2018 11:06
@danielbachhuber
Copy link
Member

By default the REST API requests load a limited chunk of records (pagination). This PR makes sure we load all the taxonomies.

Notably, the REST API itself doesn't use a per_page argument for /wp/v2/taxonomies. There's no pagination on that endpoint.

On the other endpoints that support pagination, the default is per_page=10 so I'm not sure where the magic 8 number is coming from the original bug report.

Also, on master, I notice there's still a wp/v2/taxonomies?context=edit request still being made:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Max 8 taxonomy type meta tabs
3 participants