Home › Forums › General Issues › Hiding/removing ACF custom (taxonomy) meta boxes in Gutenberg editor sidebar › Reply To: Hiding/removing ACF custom (taxonomy) meta boxes in Gutenberg editor sidebar
@fzs, thanks for your bug fix inspiration!
Somehow in WP 6.4.2 it didn’t work for me.
When I removed $taxonomy->meta_box_cb === false
it worked, but for all categories on all post types.
But since I only want to hide a specific custom category, I simply replaced it with $taxonomy->name === 'event-category'
.
So the final modified version is this:
add_filter( 'rest_prepare_taxonomy', function( $response, $taxonomy, $request ) {
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
// Context is edit in the editor
if( $context === 'edit' && $taxonomy->name === 'event-category' ){
$data_response = $response->get_data();
$data_response['visibility']['show_ui'] = false;
$response->set_data( $data_response );
}
return $response;
}, 10, 3 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.