'security', 'admin_experience' => 'admin', ); /** * Admin Experience's place on the Admin tab: right after Dashboard (20). */ private const ADMIN_EXPERIENCE_PRIORITY = 25; /** * Admin Experience's switches, moved from the Performance tab to the * Admin tab on 2026-11-06. */ private const ADMIN_EXPERIENCE_FIELDS = array( 'remove_howdy', 'remove_adminbar_items', 'screen_options' ); /** * {@inheritDoc} */ public function get_id(): string { return 'disable_features'; } /** * {@inheritDoc} */ public function register(): void { $settings = aiou()->settings(); self::move_admin_experience(); $settings->add_tab( 'performance', __( 'Performance', 'all-in-one-utilities' ), __( 'Switch off individual WordPress features to reduce requests, page weight, and surface area. This is not a caching plugin -- it is designed to work alongside whichever caching plugin you use.', 'all-in-one-utilities' ), 40 ); $priority = 10; foreach ( $this->sections() as $section_id => $section ) { $tab = self::SECTION_TABS[ $section_id ] ?? 'performance'; $settings->add_section( $tab, $section_id, $section['label'], $section['description'], 'performance' === $tab ? $priority : ( 'admin_experience' === $section_id ? self::ADMIN_EXPERIENCE_PRIORITY : 10 ) ); $field_priority = 10; foreach ( $section['fields'] as $field_id => $field_spec ) { $settings->add_field( $tab, $section_id, new Field( id: $field_id, label: $field_spec['label'], type: 'checkbox', default: 0, args: array( 'toggle_label' => $field_spec['toggle_label'] ), doc: new Doc( title: $field_spec['label'], short: $field_spec['doc_short'], detailed: $field_spec['doc_detailed'] ?? '', warnings: isset( $field_spec['doc_warning'] ) ? array( $field_spec['doc_warning'] ) : array() ), priority: $field_priority ) ); $field_priority += 10; } $priority += 10; } $this->register_extra_fields( $settings ); ( new Feature() )->register(); } /** * The two fields that aren't on/off toggles: Heartbeat's interval * (moved here from Pro) and the revisions limit. * * @param SettingsRegistry $settings The settings registry. * @return void */ private function register_extra_fields( SettingsRegistry $settings ): void { $settings->add_field( 'performance', 'frontend_performance', new Field( id: 'heartbeat_interval', label: __( 'Heartbeat interval (seconds)', 'all-in-one-utilities' ), type: 'number', default: 0, args: array( 'min' => 0, 'max' => 300, 'description' => __( 'How often Heartbeat checks in where it still runs (e.g. the post editor). 0 = WordPress default (every 60 seconds, 10 on the editor for post locks). 15 to 300 checks in at that pace and never faster, so another editor taking over a post may take that long to show.', 'all-in-one-utilities' ), ), sanitize: static fn( $value ): int => 0 === (int) $value ? 0 : max( 15, min( 300, (int) $value ) ), doc: new Doc( title: __( 'Heartbeat interval', 'all-in-one-utilities' ), short: __( 'A longer interval means less server load from autosave and session checks, with slightly less frequent autosaves.', 'all-in-one-utilities' ) ), priority: 35 ) ); $settings->add_field( 'performance', 'maintenance', new Field( id: 'revisions_limit', label: __( 'Post revisions', 'all-in-one-utilities' ), type: 'select', default: '', args: array( 'choices' => array( '' => __( 'Keep all (WordPress default)', 'all-in-one-utilities' ), '0' => __( 'Don\'t keep revisions', 'all-in-one-utilities' ), '1' => __( 'Keep the latest 1', 'all-in-one-utilities' ), '3' => __( 'Keep the latest 3', 'all-in-one-utilities' ), '5' => __( 'Keep the latest 5', 'all-in-one-utilities' ), '10' => __( 'Keep the latest 10', 'all-in-one-utilities' ), '20' => __( 'Keep the latest 20', 'all-in-one-utilities' ), ), 'description' => __( 'For every content type. Applies the next time each item is saved.', 'all-in-one-utilities' ), ), doc: new Doc( title: __( 'Limit post revisions', 'all-in-one-utilities' ), short: __( 'WordPress keeps every saved version of your posts and pages, which can grow the database a lot. Old revisions beyond the limit are removed when an item is next saved; Tools → Database Cleanup can remove them all at once.', 'all-in-one-utilities' ), detailed: __( 'Overrides a WP_POST_REVISIONS setting in wp-config.php. Autosaves are separate and unaffected.', 'all-in-one-utilities' ) ), priority: 25 ) ); } /** * The full set of sections and fields this module registers. * * Behavior for each field id lives in Feature::init(); the id here * must match the id checked there. * * @return array}> */ private function sections(): array { return array( 'frontend_performance' => array( 'label' => __( 'Frontend Performance', 'all-in-one-utilities' ), 'description' => __( 'Fewer requests and less weight on the public-facing site.', 'all-in-one-utilities' ), 'fields' => array( 'emojis' => array( 'label' => __( 'Emojis', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable support for converting emoji to images in posts', 'all-in-one-utilities' ), 'doc_short' => __( 'Saves at least one file request and roughly 16KB.', 'all-in-one-utilities' ), 'doc_detailed' => __( 'WordPress loads a script that converts plain emoji characters into images for older browsers that lack native emoji support. Nearly every current browser renders emoji natively, so this is rarely needed.', 'all-in-one-utilities' ), ), 'embed' => array( 'label' => __( 'Embed Objects', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable support for embedding objects (e.g. YouTube, Twitter) in posts', 'all-in-one-utilities' ), 'doc_short' => __( 'Saves at least one file request and roughly 6KB.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Other sites will also no longer be able to embed your posts via oEmbed.', 'all-in-one-utilities' ), ), 'heartbeat' => array( 'label' => __( 'Heartbeat', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable the auto-save/notification polling script outside the post editor', 'all-in-one-utilities' ), 'doc_short' => __( 'Saves one file request and roughly 6KB on most admin screens.', 'all-in-one-utilities' ), 'doc_detailed' => __( 'The Heartbeat API polls the server periodically for things like post locking and session checks. It is kept active on the post editor screens (needed for autosave) and only disabled elsewhere.', 'all-in-one-utilities' ), ), 'dashicons' => array( 'label' => __( 'Dashicons', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable Dashicons for visitors who are not logged in', 'all-in-one-utilities' ), 'doc_short' => __( 'Saves one file request and roughly 46KB for logged-out visitors.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Leave this off if your theme uses Dashicons on the public-facing site.', 'all-in-one-utilities' ), ), 'block_library' => array( 'label' => __( 'Block Library', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable the Gutenberg block library CSS on the frontend', 'all-in-one-utilities' ), 'doc_short' => __( 'Saves one file request and roughly 29KB.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Only enable this if you are using the Classic Editor, or your theme/page builder supplies its own block styles.', 'all-in-one-utilities' ), ), 'oembed' => array( 'label' => __( 'oEmbed', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the oEmbed discovery script from the frontend', 'all-in-one-utilities' ), 'doc_short' => __( 'Removes a script WordPress loads so embedded tweets/videos resize correctly.', 'all-in-one-utilities' ), 'doc_warning' => __( 'If your content embeds tweets or videos via oEmbed, leave this off.', 'all-in-one-utilities' ), ), 'dns_prefetch' => array( 'label' => __( 'DNS Prefetch', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the DNS-prefetch hint for WordPress\'s emoji host from the page head', 'all-in-one-utilities' ), 'doc_short' => __( 'Removes a resource hint pointing at wordpress.org\'s asset host, which most sites never use.', 'all-in-one-utilities' ), ), 'custom_css' => array( 'label' => __( 'Additional CSS', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable the Customizer\'s "Additional CSS" feature entirely', 'all-in-one-utilities' ), 'doc_short' => __( 'Built after inspecting Disable Custom CSS, a single-purpose plugin with no settings of its own. Skips a database lookup on every frontend request and removes the Customizer\'s Additional CSS panel.', 'all-in-one-utilities' ), 'doc_detailed' => __( 'On a block theme, WordPress core already merges Additional CSS into the site\'s global styles instead of printing it separately in the page head -- this toggle suppresses the CSS itself (via the wp_get_custom_css filter) so it still has no effect either way, not just the older, classic-theme output method.', 'all-in-one-utilities' ), ), ), ), 'head_cleanup' => array( 'label' => __( 'HTML Head Cleanup', 'all-in-one-utilities' ), 'description' => __( 'Remove meta tags and links from the page head that most sites never use.', 'all-in-one-utilities' ), 'fields' => array( 'generator' => array( 'label' => __( 'Generator Tag', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the WordPress version from the generator meta tag', 'all-in-one-utilities' ), 'doc_short' => __( 'Avoids advertising your exact WordPress version to anyone viewing the page source.', 'all-in-one-utilities' ), ), 'rsd_link' => array( 'label' => __( 'Really Simple Discovery', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the Really Simple Discovery (RSD) link', 'all-in-one-utilities' ), 'doc_short' => __( 'RSD was for remote-publishing clients; this protocol never became popular.', 'all-in-one-utilities' ), ), 'wlw_manifest' => array( 'label' => __( 'Windows Live Writer Manifest', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the Windows Live Writer manifest link', 'all-in-one-utilities' ), 'doc_short' => __( 'Windows Live Writer was discontinued in 2017; WordPress core itself dropped this link by default in 6.3.', 'all-in-one-utilities' ), ), 'shortlink' => array( 'label' => __( 'Shortlink', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the rel=shortlink tag and header', 'all-in-one-utilities' ), 'doc_short' => __( 'Search engines ignore this tag; few sites rely on it.', 'all-in-one-utilities' ), ), 'rss_feeds' => array( 'label' => __( 'RSS Feeds', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable RSS feed links and the feeds themselves', 'all-in-one-utilities' ), 'doc_short' => __( 'Visiting a feed URL redirects to the homepage instead. When the Feeds section below is on, its settings decide what feed URLs do.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Disable this only if you do not rely on RSS readers, feed-to-email services, or feed-based integrations.', 'all-in-one-utilities' ), ), 'adjacent_posts' => array( 'label' => __( 'Adjacent Posts', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the next/previous post links from the page head', 'all-in-one-utilities' ), 'doc_short' => __( 'These rel=next/prev links are not used by modern browsers or major search engines.', 'all-in-one-utilities' ), ), 'version_strings' => array( 'label' => __( 'Asset Version Strings', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the ?ver= query string from enqueued styles and scripts on the front end', 'all-in-one-utilities' ), 'doc_short' => __( 'Makes it slightly harder for an attacker to fingerprint exactly which plugin/theme versions you run.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Some hosts/CDNs rely on the version query string for cache-busting after updates; test thoroughly if you enable this.', 'all-in-one-utilities' ), ), 'capital_p_dangit' => array( 'label' => __( 'capital_P_dangit Filter', 'all-in-one-utilities' ), 'toggle_label' => __( 'Stop auto-correcting "Wordpress" to "WordPress" in content', 'all-in-one-utilities' ), 'doc_short' => __( 'A small, purely cosmetic content filter; disabling it saves a negligible amount of processing per request.', 'all-in-one-utilities' ), ), ), ), 'admin_experience' => array( 'label' => __( 'Admin Experience', 'all-in-one-utilities' ), 'description' => __( 'Tidy up the wp-admin toolbar and screens.', 'all-in-one-utilities' ), 'fields' => array( 'remove_howdy' => array( 'label' => __( '"Howdy" Greeting', 'all-in-one-utilities' ), 'toggle_label' => __( 'Replace "Howdy, {name}" in the toolbar with "My Profile"', 'all-in-one-utilities' ), 'doc_short' => __( 'Purely cosmetic -- some site owners find "Howdy" too informal.', 'all-in-one-utilities' ), ), 'remove_adminbar_items' => array( 'label' => __( 'Toolbar Clutter', 'all-in-one-utilities' ), 'toggle_label' => __( 'Remove the WordPress logo, "+ New", Comments, and update-count items from the toolbar', 'all-in-one-utilities' ), 'doc_short' => __( 'A shorter admin toolbar for site owners who do not use those shortcuts.', 'all-in-one-utilities' ), ), 'screen_options' => array( 'label' => __( 'Screen Options & Help', 'all-in-one-utilities' ), 'toggle_label' => __( 'Hide the Screen Options and Help tabs on admin list screens', 'all-in-one-utilities' ), 'doc_short' => __( 'These appear in the top-right corner of screens like All Posts and All Pages.', 'all-in-one-utilities' ), ), ), ), 'security_access' => array( 'label' => __( 'Hardening', 'all-in-one-utilities' ), 'description' => __( 'Switch off ways in, and information, that most sites don\'t need to expose.', 'all-in-one-utilities' ), 'fields' => array( 'xmlrpc' => array( 'label' => __( 'XML-RPC', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable XML-RPC (xmlrpc.php) and pingbacks', 'all-in-one-utilities' ), 'doc_short' => __( 'XML-RPC is an old remote-publishing interface that attackers use to try many passwords in one request. Requests to xmlrpc.php get a "403 Forbidden" reply.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Compatibility: Jetpack, the WordPress mobile apps on self-hosted sites, some desktop blogging apps, and some remote-management and backup services still use XML-RPC. Check that nothing you use needs it, and test after turning this on.', 'all-in-one-utilities' ), ), 'plugin_theme_editor' => array( 'label' => __( 'File Editing', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable the plugin and theme file editors in the dashboard', 'all-in-one-utilities' ), 'doc_short' => __( 'Removes Appearance → Theme File Editor and Plugins → Plugin File Editor, so someone who gets into an admin account can\'t change your site\'s code from there.', 'all-in-one-utilities' ), 'doc_detailed' => __( 'Works by defining WordPress\'s DISALLOW_FILE_EDIT constant. If wp-config.php already defines it, that setting wins.', 'all-in-one-utilities' ), ), 'block_user_enumeration' => array( 'label' => __( 'User Enumeration', 'all-in-one-utilities' ), 'toggle_label' => __( 'Make it harder to discover usernames', 'all-in-one-utilities' ), 'doc_short' => __( 'Blocks the ?author=1 lookup, hides the users list in the REST API and the users sitemap from visitors who aren\'t logged in, and makes login errors say "username or password is incorrect" without saying which.', 'all-in-one-utilities' ), 'doc_detailed' => __( 'Usernames can still appear elsewhere, for example in author archive URLs (see Author Pages below), in an SEO plugin\'s author sitemap (see SEO Author Sitemaps), or in a theme that prints them.', 'all-in-one-utilities' ), ), 'seo_author_sitemaps' => array( 'label' => __( 'SEO Author Sitemaps', 'all-in-one-utilities' ), 'toggle_label' => __( 'Hide the author sitemaps that SEO plugins add', 'all-in-one-utilities' ), 'doc_short' => __( 'Yoast SEO, Rank Math, All in One SEO and SEOPress publish their own author sitemap (such as author-sitemap.xml), which lists every author\'s archive URL and, with it, their username. This removes it from the sitemap index and answers it with "404 Not Found".', 'all-in-one-utilities' ), 'doc_detailed' => __( 'Only the author sitemap is affected; post, page and category sitemaps stay as they are. Search engines drop the author URLs on their next visit. If a page cache serves your sitemaps, clear it after switching this on.', 'all-in-one-utilities' ), ), 'application_passwords' => array( 'label' => __( 'Application Passwords', 'all-in-one-utilities' ), 'toggle_label' => __( 'Completely disable the Application Passwords feature', 'all-in-one-utilities' ), 'doc_short' => __( 'Application Passwords (added in WP 5.6) let external apps authenticate as a user. Disable this if nothing on your site uses it.', 'all-in-one-utilities' ), ), 'rest_api' => array( 'label' => __( 'REST API', 'all-in-one-utilities' ), 'toggle_label' => __( 'Restrict the REST API to logged-in requests only', 'all-in-one-utilities' ), 'doc_short' => __( 'Blocks anonymous access to REST API endpoints (which can otherwise expose author/user information).', 'all-in-one-utilities' ), 'doc_warning' => __( 'Disable this if your theme, a block editor feature, or another plugin needs anonymous REST API access on the frontend.', 'all-in-one-utilities' ), ), 'core_privacy_tools' => array( 'label' => __( 'Core Privacy Tools', 'all-in-one-utilities' ), 'toggle_label' => __( 'Disable the built-in Export/Erase Personal Data tools', 'all-in-one-utilities' ), 'doc_short' => __( 'Useful if you handle privacy requests through a dedicated plugin or manual process instead.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Make sure you have another way to honor data-export/erasure requests before disabling WordPress\'s own tools.', 'all-in-one-utilities' ), ), 'site_health' => array( 'label' => __( 'Site Health', 'all-in-one-utilities' ), 'toggle_label' => __( 'Hide the Tools → Site Health page', 'all-in-one-utilities' ), 'doc_short' => __( 'Site Health shows configuration details that are mostly useful to developers/support staff.', 'all-in-one-utilities' ), ), ), ), 'maintenance' => array( 'label' => __( 'Maintenance', 'all-in-one-utilities' ), 'description' => __( 'Smaller housekeeping conveniences.', 'all-in-one-utilities' ), 'fields' => array( 'core_update_email' => array( 'label' => __( 'Core Update Email', 'all-in-one-utilities' ), 'toggle_label' => __( 'Stop emailing the site admin after a background core update succeeds, fails, or needs attention', 'all-in-one-utilities' ), 'doc_short' => __( 'Built after inspecting Disable WordPress Core Update Email, a single-purpose plugin with no settings of its own.', 'all-in-one-utilities' ), 'doc_detailed' => __( 'Only covers automatic (background) core updates -- WordPress core itself never sends an email for a core update an admin triggers manually from the Updates screen, so there is nothing for this toggle to affect there.', 'all-in-one-utilities' ), ), 'empty_trash' => array( 'label' => __( 'Empty Trash Sooner', 'all-in-one-utilities' ), 'toggle_label' => __( 'Permanently delete trashed posts after 7 days instead of the default 30', 'all-in-one-utilities' ), 'doc_short' => __( 'Keeps the database a little leaner on sites that trash content often.', 'all-in-one-utilities' ), 'doc_detailed' => __( 'Runs a daily scheduled cleanup rather than changing the EMPTY_TRASH_DAYS constant, which WordPress core itself has already set by the time any plugin can run -- a constant-based approach would have no effect.', 'all-in-one-utilities' ), 'doc_warning' => __( 'Permanently deleted posts cannot be recovered. Only posts already in the Trash are affected.', 'all-in-one-utilities' ), ), 'pdf_thumbnails' => array( 'label' => __( 'PDF Thumbnails', 'all-in-one-utilities' ), 'toggle_label' => __( 'Stop generating extra image sizes when a PDF is uploaded', 'all-in-one-utilities' ), 'doc_short' => __( 'WordPress generates a full set of thumbnail sizes from a PDF\'s first page by default; most sites never display these.', 'all-in-one-utilities' ), ), 'remote_block_patterns' => array( 'label' => __( 'Remote Block Patterns', 'all-in-one-utilities' ), 'toggle_label' => __( 'Stop loading block patterns from WordPress.org', 'all-in-one-utilities' ), 'doc_short' => __( 'Speeds up the pattern inserter and avoids a remote request if you have privacy concerns about loading third-party assets.', 'all-in-one-utilities' ), ), ), ), ); } /** * Admin Experience moved from Settings → Performance to Settings → Admin. * Carry its saved switches over: on the first load after the update, * and again whenever they turn up on Performance (an older settings * export imported later, whose values then replace the ones on Admin, * as an import should). Any * other key under the old section (the retired "Clean Dashboard") is * left for AdminCustomization's own migration. * * @return void */ private static function move_admin_experience(): void { $performance = get_option( 'aiou_settings_performance' ); if ( ! is_array( $performance ) || ! isset( $performance['admin_experience'] ) || ! is_array( $performance['admin_experience'] ) ) { return; } $old = array_intersect_key( $performance['admin_experience'], array_flip( self::ADMIN_EXPERIENCE_FIELDS ) ); if ( ! $old ) { return; } $admin = get_option( 'aiou_settings_admin', array() ); $admin = is_array( $admin ) ? $admin : array(); $current = isset( $admin['admin_experience'] ) && is_array( $admin['admin_experience'] ) ? $admin['admin_experience'] : array(); $admin['admin_experience'] = array_merge( $current, array_map( 'absint', $old ) ); update_option( 'aiou_settings_admin', $admin ); $rest = array_diff_key( $performance['admin_experience'], $old ); if ( $rest ) { $performance['admin_experience'] = $rest; } else { unset( $performance['admin_experience'] ); } update_option( 'aiou_settings_performance', $performance ); } }