PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.6.1
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.6.1
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
← All changes | classes/Controllers/Frontend/Widgets.php +5 -4 2.0.42.6.1 View file →
@@ -13,8 +13,9 @@
13 13 use ContentControl\Base\Controller;
14 14
15 15 use WP_Customize_Manager;
16 16
17 +use function ContentControl\is_rest;
17 18 use function ContentControl\protection_is_disabled;
18 19 use function ContentControl\user_meets_requirements;
19 20 use function ContentControl\Widgets\get_options as get_widget_options;
20 21
@@ -26,20 +27,20 @@
26 27 /**
27 28 * Initialize Widgets Frontend.
28 29 */
29 30 public function init() {
30 - add_action( 'sidebars_widgets', [ $this, 'exclude_widgets' ] );
31 + add_filter( 'sidebars_widgets', [ $this, 'exclude_widgets' ] );
31 32 }
32 33
33 34 /**
34 35 * Checks for and excludes widgets based on their chosen options.
35 36 *
36 - * @param array $widget_areas An array of widget areas and their widgets.
37 + * @param array<string,array<string>> $widget_areas An array of widget areas and their widgets.
37 38 *
38 - * @return array The modified $widget_area array.
39 + * @return array<string,array<string>> The modified $widget_area array.
39 40 */
40 41 public function exclude_widgets( $widget_areas ) {
41 - if ( protection_is_disabled() || $this->is_customize_preview() ) {
42 + if ( is_rest() || protection_is_disabled() || $this->is_customize_preview() ) {
42 43 return $widget_areas;
43 44 }
44 45
45 46 foreach ( $widget_areas as $widget_area => $widgets ) {