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

Fix: Only 10 taxonomies with 'show_in_rest' available in the editor's sidebar #12971

Merged
merged 1 commit into from Dec 20, 2018

Conversation

Projects
None yet
4 participants
@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Dec 18, 2018

Fixes: #12649
Props to @danielbachhuber, @VadymPogorelov, and @realworldev for the debugging and testing code.

Description

In the taxonomies data request present in the PostTaxonomies component we had a per-page config of -1 to request all the taxonomies.
https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/post-taxonomies/index.js#L41

But on the checking component that verifies the post type relationship with the taxonomies we did set the per page config of -1 so only ten taxonomies were being requested.

How has this been tested?

I added the following code snippet for testing purposes:

add_action( 'init', function() {
	for ( $j=0; $j < 12; $j++ ) {
		register_post_type( 'cpt_' . $j, array(
			'label' => 'cpt ' . $j,
			'show_in_rest' => true,
			'public' => true,
		) );
		for ( $i=0; $i < 4; $i++ ) {
			register_taxonomy( 'taxonomy_' . $j . '_' . $i, 'cpt_' . $j, array(
				'label' => 'taxonomy ' . $j . ' ' .$i,
				'show_in_rest' => true,
			) );
		}
	}
});

I verified that even in CPT greater than 2 the taxnomies appear as expected, on master that's not the case.

@jorgefilipecosta jorgefilipecosta added this to the 4.8 milestone Dec 18, 2018

@youknowriad

This comment has been minimized.

Copy link
Contributor

youknowriad commented Dec 20, 2018

Would you mind rebasing to retrigger the tests?

@jorgefilipecosta jorgefilipecosta force-pushed the fix/only-ten-taxonomies-with-show_in_rest-available-in-the-editors-sidebar branch from dda7890 to 220c280 Dec 20, 2018

@jorgefilipecosta

This comment has been minimized.

Copy link
Member

jorgefilipecosta commented Dec 20, 2018

The tests passed, I'm going to merge this PR.

@jorgefilipecosta jorgefilipecosta merged commit a897e05 into master Dec 20, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jorgefilipecosta jorgefilipecosta deleted the fix/only-ten-taxonomies-with-show_in_rest-available-in-the-editors-sidebar branch Dec 20, 2018

@realworldev

This comment has been minimized.

Copy link

realworldev commented Dec 20, 2018

@jorgefilipecosta Props zu @realworldev for the code snippet for testing.

@jorgefilipecosta

This comment has been minimized.

Copy link
Member

jorgefilipecosta commented Dec 21, 2018

Sorry @realworldev, I missed your nickname. The description was corrected. Thank you for the code snippet it was very useful 👍

youknowriad added a commit that referenced this pull request Jan 3, 2019

Fix: Only 10 taxonomies with 'show_in_rest' available in the editor's…
… sidebar (#12971)

Fixes: #12649
Props to @danielbachhuber and @VadymPogorelov for the debugging.


## Description
In the taxomies data request present in the PostTaxonomies component we had a per-page config of -1 to request all the taxonomies.
https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/post-taxonomies/index.js#L41 

But on the checking component that verifies the post type relationship with the taxonomies we did set the per page config of -1 so only ten taxonomies were being requested.

## How has this been tested?
I added the following code snippet for testing purposes:
```
add_action( 'init', function() {
	for ( $j=0; $j < 12; $j++ ) {
		register_post_type( 'cpt_' . $j, array(
			'label' => 'cpt ' . $j,
			'show_in_rest' => true,
			'public' => true,
		) );
		for ( $i=0; $i < 4; $i++ ) {
			register_taxonomy( 'taxonomy_' . $j . '_' . $i, 'cpt_' . $j, array(
				'label' => 'taxonomy ' . $j . ' ' .$i,
				'show_in_rest' => true,
			) );
		}
	}
});
```
I verified that even in CPT greater than 2 the taxnomies appear as expected, on master that's not the case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment