helgatheviking / Radio-Buttons-for-Taxonomies

Turn any WordPress taxonomy into a list of radio buttons, which forces users to select only 1 term!
53 stars 28 forks source link

Conflict with default Category #103

Closed quasiDigi closed 2 years ago

quasiDigi commented 2 years ago

Hello,

There seems to be a conflict with the default Category.

Description

Post Edit View

When creating a new Post, the default Category is checked. When clicking on another Category, the default stays checked. When clicking on the default Categor y with another Category checked, both stay checked.

Posts Collumn view (all Posts view)

If in the Post Edit view different Category than the Default one has been checked, the Post will have that other Category. Also when the default Category was clicked the last in the Post Edit view. The Quick Edit works as intended.

Tests

I did several tests, one of them was with the default Twenty Twenty-One theme and without any other plugin.

The filter to disable the "no term" option is not solving anything add_filter( 'radio_buttons_for_taxonomies_no_term_category', '__return_FALSE' );

Solution

Commenting in the plugin constructor line 137 solved the issue: // Add "no term" to taxonomy rest result for Gutenberg sidebar. // add_action( 'rest_api_init', array( $this, 'register_rest_field' ) );

Thank you for your plugin and have a sweet start of the year :)

helgatheviking commented 2 years ago

Hi! Thanks so much for the detailed report. I know we can't remove the register_rest_field as that's required for inserting the "no term" field in the block editor (at least I think so from my past self's comment - not looking at the code base right this second). But it still gives me a place to start looking.

Can't promise when I'll be able to get to this, but I'll try to take a look as soon as I can.

quasiDigi commented 2 years ago

Hi,

Thank you for looking itno this. I do not use the "no term" funcionality, so I will keep this line commented for the time being. At the moment it's working as I need it to work, so no hurry on my side :)

helgatheviking commented 2 years ago

in theory, 2.4.2 solves this. let me know if it works for you.

quasiDigi commented 2 years ago

hi @helgatheviking,

Yes! The problem is solved after updating to 2.4.2.

Thank you again for coming back so fast :)