tweaks_options = get_option('abovewp_tweaks_options', array()); $this->bloat_options = get_option('abovewp_bloat_options', array()); // Run critical functions that need to execute very early $this->apply_critical_functions(); // Register admin hooks if (is_admin()) { $this->admin_hooks(); } else { $this->public_hooks(); } } /** * Register admin hooks */ private function admin_hooks() { // Include admin class require_once ABOVEWP_TWEAKS_PLUGIN_DIR . 'admin/class-abovewp-tweaks-optimizer-admin.php'; // Initialize admin $admin = new AboveWP_Tweaks_Optimizer_Admin($this->tweaks_options, $this->bloat_options); // Add settings link to plugins page add_filter('plugin_action_links_' . ABOVEWP_TWEAKS_PLUGIN_BASENAME, array($admin, 'add_settings_link')); // Register admin menu add_action('admin_menu', array($admin, 'register_admin_menu')); // Register settings add_action('admin_init', array($admin, 'register_settings')); // Enqueue admin scripts and styles add_action('admin_enqueue_scripts', array($admin, 'enqueue_admin_assets')); // Add plugin card to AboveWP dashboard add_action('abovewp_admin_dashboard_plugins', array($this, 'display_plugin_card')); } /** * Display plugin card on AboveWP dashboard */ public function display_plugin_card() { ?>
apply_tweaks(); $this->apply_bloat_removal(); } /** * Apply WordPress tweaks based on settings */ private function apply_tweaks() { // Limit post revisions if (isset($this->tweaks_options['limit_post_revisions'])) { $revisions = intval($this->tweaks_options['limit_post_revisions']); if ($revisions === 0) { // Disable post revisions completely if (!defined('WP_POST_REVISIONS')) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- WordPress core constant. define('WP_POST_REVISIONS', false); } // Also remove revision UI add_filter('wp_revisions_to_keep', '__return_zero', 10, 2); } else { if (!defined('WP_POST_REVISIONS')) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- WordPress core constant. define('WP_POST_REVISIONS', $revisions); } } } // Autosave interval if (isset($this->tweaks_options['autosave_interval'])) { $interval = intval($this->tweaks_options['autosave_interval']); if (!defined('AUTOSAVE_INTERVAL')) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- WordPress core constant. define('AUTOSAVE_INTERVAL', $interval); } // Disable autosave completely if set to 0 if ($interval === 0) { add_action('admin_init', function() { wp_deregister_script('autosave'); }); } } // Admin Heartbeat control if (isset($this->tweaks_options['admin_heartbeat'])) { $heartbeat_option = $this->tweaks_options['admin_heartbeat']; if ($heartbeat_option === 'disable_everywhere') { // Disable heartbeat completely add_action('init', function() { wp_deregister_script('heartbeat'); }, 1); } else if ($heartbeat_option === 'disable_admin') { // Disable only on admin dashboard, not in post editor add_action('init', function() { global $pagenow; if (is_admin() && $pagenow !== 'post.php' && $pagenow !== 'post-new.php') { wp_deregister_script('heartbeat'); } }, 1); } else if ($heartbeat_option === 'disable_editor') { // Keep only in post editor add_action('init', function() { global $pagenow; if (is_admin() && $pagenow !== 'post.php' && $pagenow !== 'post-new.php') { wp_deregister_script('heartbeat'); } }, 1); } // If heartbeat is not disabled completely, adjust frequency if ($heartbeat_option !== 'disable_everywhere' && isset($this->tweaks_options['heartbeat_frequency']) && $this->tweaks_options['heartbeat_frequency'] !== '') { add_filter('heartbeat_settings', function($settings) { $settings['interval'] = intval($this->tweaks_options['heartbeat_frequency']); return $settings; }); } } // Disable WP Cron and rely on server cron if (isset($this->tweaks_options['disable_wp_cron']) && $this->tweaks_options['disable_wp_cron'] === 'yes') { if (!defined('DISABLE_WP_CRON')) { define('DISABLE_WP_CRON', true); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- WordPress core constant. } } // Admin UI Cleanup if (isset($this->tweaks_options['admin_cleanup']) && $this->tweaks_options['admin_cleanup'] === 'yes') { // Remove dashboard widgets add_action('wp_dashboard_setup', function() { remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); remove_meta_box('dashboard_primary', 'dashboard', 'side'); remove_meta_box('dashboard_secondary', 'dashboard', 'side'); remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); remove_meta_box('dashboard_activity', 'dashboard', 'normal'); remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); remove_meta_box('dashboard_site_health', 'dashboard', 'normal'); }); // Remove help tabs add_action('admin_head', function() { $screen = get_current_screen(); if ($screen) { $screen->remove_help_tabs(); } }); // Remove screen options tab add_filter('screen_options_show_screen', '__return_false'); } // Disable non-essential admin notices if (isset($this->tweaks_options['disable_admin_notices']) && $this->tweaks_options['disable_admin_notices'] === 'yes') { add_action('admin_init', function() { // Keep update notices but remove others if (!current_user_can('update_core')) { remove_all_actions('admin_notices'); } }, 1); // Add back critical notices add_action('admin_notices', function() { global $pagenow; do_action('abovewp_critical_admin_notices'); // Display update notices on updates page if ($pagenow === 'update-core.php') { do_action('all_admin_notices'); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WordPress core hook. } }, 999); } // Limit login attempts if (isset($this->tweaks_options['limit_login_attempts']) && $this->tweaks_options['limit_login_attempts'] === 'yes') { // Add failed login tracking add_action('wp_login_failed', array($this, 'track_failed_login')); // Check login attempts before authentication add_filter('authenticate', array($this, 'check_login_attempts'), 30, 3); } // Enable Media Trash if (isset($this->tweaks_options['enable_media_trash']) && $this->tweaks_options['enable_media_trash'] === 'yes') { // WordPress reads this constant very early in the loading process // Our plugin loads too late to set it effectively for the current page load // We'll add a hidden field to our settings form to indicate this setting needs special treatment add_action('admin_enqueue_scripts', function() { $page = isset($_GET['page']) ? sanitize_text_field(wp_unslash($_GET['page'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading page slug for conditional output only. if ($page === 'abovewp-tweaks-optimizer') { $script = 'jQuery(document).ready(function($) { $("input[name=\"abovewp_tweaks_options[enable_media_trash]\"]").parents("tr").addClass("special-setting"); $("input[name=\"abovewp_tweaks_options[enable_media_trash]\"]").parent().append("Requires adding to wp-config.php or page reload to take effect"); });'; wp_add_inline_script('jquery', $script); } }); // Try to auto-add the constant to wp-config.php if possible if (!defined('MEDIA_TRASH')) { global $wp_filesystem; if (empty($wp_filesystem)) { require_once ABSPATH . 'wp-admin/includes/file.php'; WP_Filesystem(); } $wp_config_path = ABSPATH . 'wp-config.php'; if ($wp_filesystem->is_writable($wp_config_path)) { $wp_config_content = $wp_filesystem->get_contents($wp_config_path); if ($wp_config_content && strpos($wp_config_content, "define('MEDIA_TRASH'") === false && strpos($wp_config_content, "define(\"MEDIA_TRASH\"") === false) { $line_to_add = "define('MEDIA_TRASH', true);"; $insertion_point = strpos($wp_config_content, "/* That's all, stop editing!"); if ($insertion_point !== false) { $new_config = substr($wp_config_content, 0, $insertion_point); $new_config .= "// Added by AboveWP Tweaks Optimizer\n"; $new_config .= "$line_to_add\n\n"; $new_config .= substr($wp_config_content, $insertion_point); $wp_filesystem->put_contents($wp_config_path, $new_config); } } } } } } /** * Track failed login attempts */ public function track_failed_login($username) { $ip = isset($_SERVER['REMOTE_ADDR']) ? sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])) : ''; if (empty($ip)) { return; } $attempts = get_transient('abovewp_login_attempts_' . $ip); if (!$attempts) { $attempts = 1; } else { $attempts++; } // Get lockout time setting (in minutes) $lockout_time = isset($this->tweaks_options['login_lockout_time']) ? intval($this->tweaks_options['login_lockout_time']) : 60; // Default to 60 minutes // Convert to seconds $lockout_seconds = $lockout_time * 60; // Store attempts with the configurable lockout time set_transient('abovewp_login_attempts_' . $ip, $attempts, $lockout_seconds); } /** * Check login attempts before authentication */ public function check_login_attempts($user, $username, $password) { // Skip if it's already a WP_Error or empty username if (is_wp_error($user) || empty($username)) { return $user; } $ip = isset($_SERVER['REMOTE_ADDR']) ? sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])) : ''; if (empty($ip)) { return $user; } $attempts = get_transient('abovewp_login_attempts_' . $ip); // Get attempts limit setting $max_attempts = isset($this->tweaks_options['login_attempts_limit']) ? intval($this->tweaks_options['login_attempts_limit']) : 5; // Default to 5 attempts // Get lockout time setting (in minutes) $lockout_time = isset($this->tweaks_options['login_lockout_time']) ? intval($this->tweaks_options['login_lockout_time']) : 60; // Default to 60 minutes // Block after configured failed attempts if ($attempts && $attempts >= $max_attempts) { return new WP_Error('too_many_attempts', sprintf( /* translators: %s: Human-readable time difference until lockout expires */ __('ERROR: Too many failed login attempts. Please try again in %s.', 'abovewp-tweaks-optimizer'), human_time_diff(time(), time() + ($lockout_time * 60)) )); } return $user; } /** * Apply bloat removal based on settings */ private function apply_bloat_removal() { // Disable Gutenberg if (isset($this->bloat_options['disable_gutenberg']) && $this->bloat_options['disable_gutenberg'] === 'yes') { // Load the dedicated Gutenberg disabler require_once ABOVEWP_TWEAKS_PLUGIN_DIR . 'includes/disable-gutenberg.php'; // The rest of the Gutenberg disabling code is now in the dedicated class // This code remains here for backward compatibility add_filter('use_block_editor_for_post', '__return_false', 999); add_filter('use_block_editor_for_post_type', '__return_false', 999); } // Disable comments if (isset($this->bloat_options['disable_comments']) && $this->bloat_options['disable_comments'] === 'yes') { add_action('admin_init', function() { // Remove comments metabox from dashboard remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // Disable support for comments and trackbacks in post types foreach (get_post_types() as $post_type) { if (post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } }); // Close comments on front-end add_filter('comments_open', '__return_false', 20, 2); add_filter('pings_open', '__return_false', 20, 2); // Hide existing comments add_filter('comments_array', '__return_empty_array', 10, 2); // Remove comments page in menu add_action('admin_menu', function() { remove_menu_page('edit-comments.php'); }); // Remove comments links from admin bar add_action('init', function() { if (is_admin_bar_showing()) { remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } }); } // Disable embeds if (isset($this->bloat_options['disable_embeds']) && $this->bloat_options['disable_embeds'] === 'yes') { add_action('wp_footer', function() { wp_deregister_script('wp-embed'); }); add_filter('embed_oembed_discover', '__return_false'); remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10); remove_action('wp_head', 'wp_oembed_add_discovery_links'); remove_action('wp_head', 'wp_oembed_add_host_js'); add_filter('tiny_mce_plugins', function($plugins) { if (is_array($plugins)) { return array_diff($plugins, array('wpembed')); } return $plugins; }); add_filter('rewrite_rules_array', function($rules) { foreach($rules as $rule => $rewrite) { if (strpos($rewrite, 'embed=true') !== false) { unset($rules[$rule]); } } return $rules; }); } // Disable REST API if (isset($this->bloat_options['disable_rest_api']) && $this->bloat_options['disable_rest_api'] === 'yes') { add_filter('rest_authentication_errors', function($result) { if (!empty($result)) { return $result; } if (!is_user_logged_in()) { return new WP_Error('rest_not_logged_in', 'You are not currently logged in.', array('status' => 401)); } return $result; }); // Remove REST API links remove_action('wp_head', 'rest_output_link_wp_head', 10); remove_action('template_redirect', 'rest_output_link_header', 11); } // Disable feed links if (isset($this->bloat_options['disable_feed_links']) && $this->bloat_options['disable_feed_links'] === 'yes') { remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'feed_links_extra', 3); add_action('do_feed', array($this, 'disable_feed'), 1); add_action('do_feed_rdf', array($this, 'disable_feed'), 1); add_action('do_feed_rss', array($this, 'disable_feed'), 1); add_action('do_feed_rss2', array($this, 'disable_feed'), 1); add_action('do_feed_atom', array($this, 'disable_feed'), 1); add_action('do_feed_rss2_comments', array($this, 'disable_feed'), 1); add_action('do_feed_atom_comments', array($this, 'disable_feed'), 1); } // Disable RSS and Atom feeds if (isset($this->bloat_options['disable_all_feeds']) && $this->bloat_options['disable_all_feeds'] === 'yes') { // Make sure all feed actions are removed and redirected remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'feed_links_extra', 3); // Add our feed disabling actions add_action('do_feed', array($this, 'disable_feed'), 1); add_action('do_feed_rdf', array($this, 'disable_feed'), 1); add_action('do_feed_rss', array($this, 'disable_feed'), 1); add_action('do_feed_rss2', array($this, 'disable_feed'), 1); add_action('do_feed_atom', array($this, 'disable_feed'), 1); add_action('do_feed_rss2_comments', array($this, 'disable_feed'), 1); add_action('do_feed_atom_comments', array($this, 'disable_feed'), 1); // Remove feed links from header add_filter('feed_links_show_posts_feed', '__return_false'); add_filter('feed_links_show_comments_feed', '__return_false'); } // Disable author archives if (isset($this->bloat_options['disable_author_archives']) && $this->bloat_options['disable_author_archives'] === 'yes') { add_action('template_redirect', array($this, 'disable_author_archives')); // Remove author URLs from sitemap add_filter('wp_sitemaps_add_provider', function($provider, $name) { if ('users' === $name) { return false; } return $provider; }, 10, 2); // Remove author URLs from head links add_filter('author_link', function($link) { return home_url('/'); }); } // Disable Dashicons on front-end if (isset($this->bloat_options['disable_dashicons']) && $this->bloat_options['disable_dashicons'] === 'yes') { add_action('wp_enqueue_scripts', function() { if (!is_user_logged_in()) { wp_deregister_style('dashicons'); } }); } // Disable shortlinks if (isset($this->bloat_options['disable_shortlinks']) && $this->bloat_options['disable_shortlinks'] === 'yes') { remove_action('wp_head', 'wp_shortlink_wp_head', 10); remove_action('template_redirect', 'wp_shortlink_header', 11); } // Disable WP version if (isset($this->bloat_options['disable_wp_version']) && $this->bloat_options['disable_wp_version'] === 'yes') { // Remove version from generator meta tag remove_action('wp_head', 'wp_generator'); add_filter('the_generator', '__return_empty_string'); // Remove WordPress version from RSS feeds add_filter('style_loader_src', array($this, 'remove_version_from_url'), 9999); add_filter('script_loader_src', array($this, 'remove_version_from_url'), 9999); // Remove WP version from admin footer add_filter('update_footer', '__return_empty_string', 9999); add_filter('admin_footer_text', function($content) { return preg_replace('/WordPress \d+\.\d+(\.\d+)?/', 'WordPress', $content); }); // Remove version from REST API responses add_filter('rest_authentication_errors', function($errors) { // Remove server header with version remove_filter('rest_pre_serve_request', 'rest_send_server_header'); return $errors; }, 9); // Remove version from login page add_filter('login_headerurl', function() { return home_url(); }); // Remove version parameter from all enqueued scripts and styles add_action('wp_print_scripts', function() { global $wp_scripts; if (isset($wp_scripts->registered) && is_array($wp_scripts->registered)) { foreach ($wp_scripts->registered as $script) { $script->ver = null; } } }, 9999); add_action('wp_print_styles', function() { global $wp_styles; if (isset($wp_styles->registered) && is_array($wp_styles->registered)) { foreach ($wp_styles->registered as $style) { $style->ver = null; } } }, 9999); } // Disable RSD links if (isset($this->bloat_options['disable_rsd']) && $this->bloat_options['disable_rsd'] === 'yes') { // Use very early priority to ensure it runs add_action('init', function() { remove_action('wp_head', 'rsd_link'); }, 1); // Remove on template_redirect as well to catch any late additions add_action('template_redirect', function() { remove_action('wp_head', 'rsd_link'); }, 1); } // Disable wlwmanifest link if (isset($this->bloat_options['disable_wlwmanifest']) && $this->bloat_options['disable_wlwmanifest'] === 'yes') { // Use very early priority to ensure it runs add_action('init', function() { remove_action('wp_head', 'wlwmanifest_link'); }, 1); // Remove on template_redirect as well to catch any late additions add_action('template_redirect', function() { remove_action('wp_head', 'wlwmanifest_link'); }, 1); } // Disable admin bar if (isset($this->bloat_options['disable_admin_bar']) && $this->bloat_options['disable_admin_bar'] === 'yes') { add_filter('show_admin_bar', '__return_false'); } // Disable WordPress emoji release script if (isset($this->bloat_options['disable_wp_emoji_release']) && $this->bloat_options['disable_wp_emoji_release'] === 'yes') { remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); remove_action('wp_print_styles', 'print_emoji_styles'); remove_action('admin_print_styles', 'print_emoji_styles'); remove_filter('the_content_feed', 'wp_staticize_emoji'); remove_filter('comment_text_rss', 'wp_staticize_emoji'); remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); add_filter('emoji_svg_url', '__return_false'); add_filter('tiny_mce_plugins', function($plugins) { if (is_array($plugins)) { return array_diff($plugins, array('wpemoji')); } return $plugins; }); } // Disable self pingbacks if (isset($this->bloat_options['disable_self_pingbacks']) && $this->bloat_options['disable_self_pingbacks'] === 'yes') { add_action('pre_ping', function(&$links) { $home = home_url(); foreach ($links as $l => $link) { if (strpos($link, $home) === 0) { unset($links[$l]); } } }); } // Disable XML-RPC if (isset($this->bloat_options['disable_xmlrpc']) && $this->bloat_options['disable_xmlrpc'] === 'yes') { add_filter('xmlrpc_enabled', '__return_false'); add_filter('xmlrpc_methods', '__return_empty_array'); remove_action('wp_head', 'rsd_link'); } // Enable Classic Widgets if (isset($this->bloat_options['enable_classic_widgets']) && $this->bloat_options['enable_classic_widgets'] === 'yes') { // Call our dedicated method to properly enable classic widgets $this->enable_classic_widgets(); } // Remove query strings from static resources if (isset($this->bloat_options['disable_query_strings']) && $this->bloat_options['disable_query_strings'] === 'yes') { add_filter('script_loader_src', array($this, 'remove_version_from_url'), 15); add_filter('style_loader_src', array($this, 'remove_version_from_url'), 15); } // Apply WooCommerce optimizations if WooCommerce is active if (function_exists('WC') || class_exists('WooCommerce')) { $this->apply_woocommerce_optimizations(); } } /** * Apply WooCommerce optimizations based on settings */ private function apply_woocommerce_optimizations() { // Get WooCommerce options $woocommerce_options = get_option('abovewp_woocommerce_options', array()); // Disable password strength meter if (isset($woocommerce_options['disable_password_strength_meter']) && $woocommerce_options['disable_password_strength_meter'] === 'yes') { // Remove from all pages, including checkout and account pages add_action('wp_enqueue_scripts', function() { // Remove password strength meter wp_dequeue_script('wc-password-strength-meter'); wp_dequeue_script('password-strength-meter'); wp_deregister_script('wc-password-strength-meter'); wp_deregister_script('password-strength-meter'); // Also remove the zxcvbn script which powers the strength calculations wp_dequeue_script('zxcvbn-async'); wp_deregister_script('zxcvbn-async'); // Remove the inline script that triggers the strength meter add_filter('woocommerce_my_account_script_params', function($params) { if (isset($params['min_password_strength'])) { $params['min_password_strength'] = 0; } return $params; }, 999); // Remove any inline script that refers to password strength add_filter('woocommerce_get_script_data', function($data, $handle) { if ($handle === 'wc-password-strength-meter') { return false; } return $data; }, 10, 2); }, 100); // Add CSS to hide any strength indicators add_action('wp_enqueue_scripts', function() { $css = '.woocommerce-password-strength, .woocommerce-password-hint, small.woocommerce-password-hint, .woocommerce-password-strength.short, .woocommerce-password-strength.bad, .woocommerce-password-strength.good, .woocommerce-password-strength.strong { display: none !important; visibility: hidden !important; }'; wp_register_style('abovewp-woo-tweaks', false, array(), ABOVEWP_TWEAKS_VERSION); wp_enqueue_style('abovewp-woo-tweaks'); wp_add_inline_style('abovewp-woo-tweaks', $css); }); } // Remove product tabs using individual settings (only if at least one tab removal is enabled) $has_tab_removal = ( (isset($woocommerce_options['disable_reviews_tab']) && $woocommerce_options['disable_reviews_tab'] === 'yes') || (isset($woocommerce_options['disable_description_tab']) && $woocommerce_options['disable_description_tab'] === 'yes') || (isset($woocommerce_options['disable_additional_information_tab']) && $woocommerce_options['disable_additional_information_tab'] === 'yes') ); if ($has_tab_removal) { add_filter('woocommerce_product_tabs', function($tabs, $product = null) use ($woocommerce_options) { // If there are no tabs or tabs are empty, just return if (empty($tabs)) { return array(); } // Check and remove each tab individually based on settings if (isset($woocommerce_options['disable_reviews_tab']) && $woocommerce_options['disable_reviews_tab'] === 'yes' && isset($tabs['reviews'])) { unset($tabs['reviews']); } if (isset($woocommerce_options['disable_description_tab']) && $woocommerce_options['disable_description_tab'] === 'yes' && isset($tabs['description'])) { unset($tabs['description']); } if (isset($woocommerce_options['disable_additional_information_tab']) && $woocommerce_options['disable_additional_information_tab'] === 'yes' && isset($tabs['additional_information'])) { unset($tabs['additional_information']); } return $tabs; }, 999, 2); } } /** * Remove version parameter from static resources * * @param string $src URL of the resource * @return string URL without version parameter */ public function remove_version_from_url($src) { if (strpos($src, 'ver=')) { $src = remove_query_arg('ver', $src); } return $src; } /** * Disable feeds */ public function disable_feed() { wp_safe_redirect(home_url('/'), 301); exit; } /** * Disable author archives and redirect to homepage */ public function disable_author_archives() { if (is_author()) { wp_safe_redirect(home_url('/'), 301); exit; } } /** * Enable classic widgets editor * Completely disables the block-based widgets editor */ public function enable_classic_widgets() { // Disable the block-based widgets editor via filters add_filter('use_widgets_block_editor', '__return_false'); add_filter('gutenberg_use_widgets_block_editor', '__return_false'); add_filter('wp_use_widgets_block_editor', '__return_false'); add_filter('customize_widgets_block_editor_enabled', '__return_false'); // Remove theme support for block widgets add_action('after_setup_theme', function() { remove_theme_support('widgets-block-editor'); }, 100); // Ensure customizer uses classic widgets add_action('customize_register', function() { remove_theme_support('widgets-block-editor'); }, 0); } /** * Apply critical functions that need to run very early */ private function apply_critical_functions() { // Check if classic widgets is enabled and apply immediately if (isset($this->bloat_options['enable_classic_widgets']) && $this->bloat_options['enable_classic_widgets'] === 'yes') { $this->enable_classic_widgets(); } } }