• Resolved T.Fujita

    (@fujix)


    I’m struggling with Gutenberg.
    Is it possible to limit category selection per post to one?

    Previously, I used jQuery to watch the category panel on the right side, but in Gutenberg the panel is controlled by React, the old method doesn’t work well anymore.

    The theme supports only one category with hierarchy.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi –

    Are you talking about the categories that are listed in the Document section when editing a post? Could you grab a screen shot to share?

    Thread Starter T.Fujita

    (@fujix)

    Hi,

    Are you talking about the categories that are listed in the Document section when editing a post?

    Exactly.

    Looks like there are some plugin to achieve this for classic editor by changing the check boxes into a dropdown list or radio buttons.

    https://www.wpbeginner.com/plugins/how-to-enforce-one-category-per-post-in-wordpress/

    Now I limit this by jQuery like this

          var cat_checklist = $('.categorychecklist input[type=checkbox]');
          cat_checklist.click( function() {
            $(this).parents('.categorychecklist').find('input[type=checkbox]').attr('checked', false);
            $(this).attr('checked', true);
          });

    Do you still need help or do you have it sorted?

    Thread Starter T.Fujita

    (@fujix)

    It is not sorted out but looks like thre is no solution for this.

    Thanks for reply.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Limit one category per post’ is closed to new replies.