Skip to content

Bulk Edit Roles setting cannot be saved as “none selected” (all roles re-check after save) #381

@mduschak

Description

@mduschak

Summary

In Nested Pages settings, the Bulk Edit Roles checkboxes for a post type cannot be persisted as fully unchecked. If all roles are unchecked and saved, the page reloads with all roles checked again.

Environment

WordPress multisite
Nested Pages settings URL:
wp-admin/options-general.php?page=nested-pages-settings&tab=posttypes
Reproduced on custom post types and plugin-generated post types

Steps to Reproduce

  1. Go to Settings > Nested Pages > Post Types.
  2. Expand any post type row.
  3. In Bulk Edit Roles, check all role checkboxes.
  4. Click Save Changes.
  5. In Bulk Edit Roles, uncheck all role checkboxes.
  6. Click Save Changes.

Expected Behavior

All roles remain unchecked (or the saved state clearly reflects “no roles allowed for bulk edit”).

Actual Behavior

All roles reappear checked again after save.

Likely Cause

bulk_edit_roles[] is a checkbox array. When all are unchecked, the browser submits no key for that field.
Current role check rendering appears to treat missing/empty bulk_edit_roles as “allowed for all roles,” so all boxes are shown checked on reload.

Impact

Cannot use UI to persist “disable bulk edit for all roles” per post type.
Settings appear to revert, causing admin confusion and policy mismatch.

Suggested Fix

One of:

  1. Save an explicit empty array/value for bulk_edit_roles when all are unchecked, and interpret it as “none allowed,” or
  2. Add an explicit “Allow all roles” toggle and disambiguate empty/missing state from an intentional selection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions