Skip to content

Create Screen Options Control Plugin (Post Type + Role Based) #1

Description

@vishal4669

Summary

Build a WordPress plugin that allows administrators to define default Screen Options (list table columns) per post type and user role. These settings are saved globally and enforced consistently for users, with an optional lock to prevent users from changing column visibility via native Screen Options.

This ticket incorporates the approved concept flow from Miro and aligns implementation with that UX.

Image


Problem / Why

WordPress stores Screen Options per user, resulting in inconsistent admin list views across roles and users. There is no native way to centrally manage or enforce defaults. This plugin introduces a global, role-based screen defaults manager to standardize admin workflows.


Goals

  • Define default visible columns by:
    • Post Type (Posts, Pages, CPTs)
    • User Role
  • Enforce these defaults globally.
  • Provide a clean configuration wizard aligned with the Miro concept flow.
  • Optionally lock column visibility so users cannot override defaults.

Concept Flow (Based on Miro)

Entry Point

Settings → Screen Defaults


Screen 1: Screen Options Manager (List View)

  • Displays a table of configured views.
  • Each row represents a saved configuration:
    • Post Type
    • Role
    • Columns shown
    • Status (Locked / Unlocked)
  • Actions:
    • Configure View (create new)
    • Edit View
  • Table supports:
    • Filters
    • Sorting
  • Implementation note:
    • Prefer Gutenberg components
    • If not feasible, use WordPress Data Tables for performance

Screen 2: Configure View – Select Post Type

  • User selects a Post Type (Posts, Pages, Media, CPTs).
  • Available columns for the selected post type are fetched dynamically.
  • Technical note:
    • Columns can be derived using list table headers (get_column_headers() or equivalent).

Screen 3: Configure View – Select Role

  • User selects a User Role.
  • Rules:
    • Only one view per role per post type is allowed.
    • Special role option:
      • All Users → Applies WordPress defaults
  • Validation prevents duplicate role + post type combinations.

Screen 4: Configure View – Configure Columns

  • Displays available columns as a selectable list.
  • User can:
    • Enable / disable columns
    • Reorder columns (if feasible in v1)
  • Option:
    • Lock Configuration
      • If enabled, users cannot change columns via native Screen Options.
  • Action:
    • Create View / Save Changes

Screen 5: Edit View

  • Edit screen shows only the configuration wizard, not the list table.
  • Allows updating:
    • Columns
    • Lock status
  • Save updates globally.

Non-Goals

  • Managing pagination, sorting preferences, or filters (v1).
  • Supporting non-list-table admin screens.

Requirements / Acceptance Criteria

Functional

  1. Admin can create exactly one configuration per:
    • Post Type + Role
  2. Defaults apply automatically when user visits the listing pages
  3. Fallback logic:
  • Role-specific config
  • Post-type default (if implemented)
  • WordPress default
  1. Column configuration is stored globally, not per-user.
  2. Unknown or removed columns are ignored safely.

Locking Behavior

  1. If Lock Configuration is enabled:
  • User changes via “Screen Options” are ignored or reverted.
  1. If unlocked:
  • User may temporarily adjust columns, but defaults still apply initially.

Permissions & Security

  1. Only users with manage_options (or equivalent) can manage views.
  2. Nonces and capability checks are mandatory.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions