Taxonomy_Single_Term icon indicating copy to clipboard operation
Taxonomy_Single_Term copied to clipboard

Gutenberg hide built-in term meta box

Open normanlolx opened this issue 6 years ago • 0 comments

In WP 5 with Gutenberg remove_meta_box doesn't seem to have any effect anymore.

The following workaround from https://github.com/WordPress/gutenberg/issues/6912#issuecomment-428403380 might temporarily fix this. I slightly adapted it to hide the post_tag metabox instead of the category meta box from the original snippet.

/**
 * Disable display of Gutenberg Post Setting UI for a specific
 * taxonomy. While this isn't the official API for this need,
 * it works for now because only Gutenberg is dependent on the
 * REST API response.
 */
add_filter( 'rest_prepare_taxonomy', function( $response, $taxonomy ){
	if ( 'post_tag' === $taxonomy->name ) {
		$response->data['visibility']['show_ui'] = false;
	}
	return $response;
}, 10, 2 );

normanlolx avatar Feb 14 '19 14:02 normanlolx