Stop printing global custom css when single style custom css is not set#2703
Conversation
WalkthroughThe changes add defensive null-checking to the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
classes/controllers/FrmStylesController.php (1)
869-872: Enhance parameter documentation.The
$single_style_settingsparameter should document the expected array structure, specifically that it should containsingle_style_custom_cssandenable_style_custom_csskeys.🔎 Suggested documentation improvement
/** * Get custom CSS code entered in the Custom CSS page. * * @since 6.0 * - * @param array|null $single_style_settings The single style settings. + * @param array|null $single_style_settings { + * Optional. The single style settings array. + * + * @type string $single_style_custom_css Custom CSS for the single style. + * @type bool $enable_style_custom_css Whether custom CSS is enabled. + * } * * @return string */
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
classes/controllers/FrmStylesController.phpcss/_single_theme.css.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: PHP 8 tests in WP 6.9
- GitHub Check: PHP 7.4 tests in WP 6.9
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP 6.9
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP 6.9
🔇 Additional comments (2)
css/_single_theme.css.php (1)
16-17: LGTM - Good optimization using null-coalescing.The null-coalescing operators correctly avoid re-evaluating helper functions if these variables are already defined via the
extract($settings)on line 7. This optimization prevents redundant function calls while maintaining the same functionality.classes/controllers/FrmStylesController.php (1)
874-880: Behavior change is intentional and safe.The new logic requiring BOTH
single_style_custom_cssANDenable_style_custom_csscorrectly implements the feature. This change only affects the single-style-specific CSS rendering path (called in_single_theme.css.php). Global CSS calls incustom_theme.css.phpandFrmStylesController.phpbypass this logic entirely and continue to use the default settings. Sinceenable_style_custom_cssdefaults to false and the UI controls visibility of the CSS editor with a toggle, the change safely enforces user intent without breaking existing functionality.
…css_when_single_style_custom_css_is_not_set Stop printing global custom css when single style custom css is not set
No description provided.