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

Manage block Category #8957

Closed
amritdeepkaur opened this issue Aug 14, 2018 · 4 comments
Closed

Manage block Category #8957

amritdeepkaur opened this issue Aug 14, 2018 · 4 comments
Labels
[Status] Needs More Info Follow-up required in order to be actionable. [Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@amritdeepkaur
Copy link

Hi Gutenberg team,
From the link
#7606
i get to know that i can create my own custom category and in Gutenberg 3.4, its working fine,
But recently i update the plugin to version 3.5 and the following code is not working.

add_filter( 'block_categories', function( $categories, $post ) {
if ( $post->post_type !== 'post' ) {
	return $categories;
}
return array_merge(
	$categories,
	array(
		array(
			'slug' => 'my-category',
			'title' => __( 'My category', 'my-plugin' ),
		),
	)
);

}, 10, 2 );

What should i do???

@ajitbohra ajitbohra added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Aug 14, 2018
@designsimply designsimply added the Needs Technical Feedback Needs testing from a developer perspective. label Aug 15, 2018
@youknowriad
Copy link
Contributor

It's working just fine for me with your code (make sure to register at least a block for you category)

@youknowriad youknowriad added [Status] Needs More Info Follow-up required in order to be actionable. and removed Needs Technical Feedback Needs testing from a developer perspective. labels Aug 22, 2018
@mtias
Copy link
Member

mtias commented Aug 24, 2018

Closing as it should be working. Please, reopen if it doesn't.

@martinharperlee
Copy link

I also see this as an issue with the exact same code shown above, using v3.9.0

@fvonellerts
Copy link

fvonellerts commented Jan 25, 2019

I also had this problem, fixed it by adding a block to the category, building the React package and splitting the add_action hooks into enqueue_block_editor_assets, enqueue_block_assets and init (after the category registration) instead of only init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs More Info Follow-up required in order to be actionable. [Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

7 participants