Ollie Theme Academy

Understanding Settings

Removing settings by post type or role

Sometimes you need different editing capabilities for different post types or user roles. PHP filters on theme.json make this possible in your block theme.

Use the wp_theme_json_data_theme and wp_theme_json_data_default filters to modify theme.json based on context. Check the current screen for post type or user capabilities to conditionally apply different settings.

Important: only run these filters in admin contexts to avoid breaking frontend functionality. Your theme.json controls both styling and editor behavior, so removing settings on the frontend could break your design system.

Create separate theme.json configurations as PHP arrays (using json_decode for easier maintenance) and inject them when conditions are met. This approach gives you complete control over who can access which editing features.

Back to: Ollie Theme Academy > Understanding Settings