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

Block Editor is not using the wp_terms_checklist_args filter #16935

theMikeD opened this issue Aug 6, 2019 · 3 comments


Copy link

commented Aug 6, 2019

Describe the bug
There is a filter called wp_terms_checklist_args that allows me to modify how a taxonomy's terms are shown to the end user on the post edit screen. This filter works fine in the classic editor, but is not called with gutenberg and I can't seem to find a way to do it using filters. This is happening with WP 5.2.2 with the default theme and no plugins other that Classic Editor active.

To reproduce
Steps to reproduce the behaviour:

  1. Create a new WP install using 5.2.2.
  2. Install the Classic Editor plugin and select 'Allow users to switch editors'
  3. Add the following code to the default theme's functions.php
function restrict_metabox_selections( $opts, $post_id ) {
	error_log( __FUNCTION__ );
	return $opts;
add_filter( 'wp_terms_checklist_args', 'restrict_metabox_selections', 10, 2 );
  1. Open the php error log
  2. Edit any post in the Classic Editor
    Result: You will see restrict_metabox_selections in the log, indicating that the filter is being called.
  3. Edit any post in the Block Editor
    Result: You will not see restrict_metabox_selections in the log, indicating that the filter is not being called.

Expected behavior
The filter should be called by both Classic and Block editors.

Desktop (please complete the following information):

  • OS: OSX
  • BrowserChrome, Firefox
  • Version Latest

This comment has been minimized.

Copy link

commented Aug 7, 2019

The block editor uses the REST API to retrieve a list of tags, so the wp_terms_checklist_args does not work in that context.

What do you want to achieve? Maybe there's another way to do what you're looking for.


This comment has been minimized.

Copy link

commented Aug 7, 2019

Ah well that would explain it. I have a two-level hierarchical taxonomy and I restrict the user from selecting the parent, only the children, by removing the checkbox for the parent in the Walker.

Here is what that filter allows me to do in the classic editor:
Notice how the top-level terms ( "Cakemakers and Bakers" for example) are not selectable.

Here is what happens in the block editor


This comment has been minimized.

Copy link

commented Aug 12, 2019

My similar problem is to modify the post-new.php screen. I have a custom taxonomy, and I want to default certain terms as "checked" or not. I think I can use wp_terms_checklist_args in classic, but I don't know how to use it in Gutenberg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.