set_404(); status_header( 404 ); } } ); } // -------------------------------------------------------------------------- // 3. capital_P_dangit // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'capital_p_dangit' ) ) { add_action( 'init', function () { foreach ( array( 'the_content', 'the_title', 'comment_text', 'widget_text' ) as $filter ) { $priority = has_filter( $filter, 'capital_P_dangit' ); if ( false !== $priority ) { remove_filter( $filter, 'capital_P_dangit', $priority ); } } }, 11 ); } // -------------------------------------------------------------------------- // 4. Screen Options and Help // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'screen_options_help' ) ) { add_filter( 'screen_options_show_screen', '__return_false' ); add_filter( 'contextual_help', function ( $old_help, $screen_id, $screen ) { $screen->remove_help_tabs(); return $old_help; }, 10, 3 ); } // -------------------------------------------------------------------------- // 5. "Howdy" in Admin Bar // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'howdy' ) ) { add_filter( 'admin_bar_menu', function ( $wp_admin_bar ) { $my_account = $wp_admin_bar->get_node( 'my-account' ); if ( $my_account ) { $title = str_replace( 'Howdy,', 'Welcome,', $my_account->title ); $wp_admin_bar->add_node( array( 'id' => 'my-account', 'title' => $title ) ); } }, 25 ); } // -------------------------------------------------------------------------- // 6. Admin Bar Navigation Items // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'adminbar_nav' ) ) { add_action( 'wp_before_admin_bar_render', function () { global $wp_admin_bar; $nodes = array( 'wp-logo', 'about', 'wporg', 'documentation', 'support-forums', 'feedback', 'site-name', 'view-site', 'updates', 'comments', 'new-content', 'customize', ); foreach ( $nodes as $node ) { $wp_admin_bar->remove_node( $node ); } } ); } // -------------------------------------------------------------------------- // 7. Clean Dashboard // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'clean_dashboard' ) ) { add_action( 'wp_dashboard_setup', function () { global $wp_meta_boxes; $wp_meta_boxes['dashboard'] = array(); } ); } // -------------------------------------------------------------------------- // 8. Emojis // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'emojis' ) ) { 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( 'tiny_mce_plugins', function ( $plugins ) { return array_diff( $plugins, array( 'wpemoji' ) ); } ); add_filter( 'wp_resource_hints', function ( $urls, $relation_type ) { if ( 'dns-prefetch' === $relation_type ) { $emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' ); $urls = array_diff( $urls, array( $emoji_svg_url ) ); } return $urls; }, 10, 2 ); } // -------------------------------------------------------------------------- // 9. Embed Objects // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'embeds' ) ) { remove_action( 'wp_head', 'wp_oembed_add_discovery_links' ); remove_action( 'wp_head', 'wp_oembed_add_host_js' ); remove_action( 'rest_api_init', 'wp_oembed_register_route' ); remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 ); remove_action( 'template_redirect', 'rest_output_link_header', 11 ); add_filter( 'embed_oembed_discover', '__return_false' ); } // -------------------------------------------------------------------------- // 10. Dashicons (frontend, non-logged-in) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'dashicons' ) ) { add_action( 'wp_enqueue_scripts', function () { if ( ! is_user_logged_in() ) { wp_deregister_style( 'dashicons' ); } } ); } // -------------------------------------------------------------------------- // 11. Heartbeat // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'heartbeat' ) ) { add_action( 'init', function () { wp_deregister_script( 'heartbeat' ); } ); } // -------------------------------------------------------------------------- // 12. XML-RPC + Pingback // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'xmlrpc' ) ) { add_filter( 'xmlrpc_enabled', '__return_false' ); add_filter( 'wp_headers', function ( $headers ) { unset( $headers['X-Pingback'] ); return $headers; } ); add_action( 'xmlrpc_call', function () { wp_die( esc_html__( 'XML-RPC is disabled.', 'abhishek-site-cleanup-controls' ) ); } ); } // -------------------------------------------------------------------------- // 13. Generator Meta Tag // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'generator' ) ) { remove_action( 'wp_head', 'wp_generator' ); add_filter( 'the_generator', '__return_empty_string' ); } // -------------------------------------------------------------------------- // 14. WLW Manifest // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'wlw_manifest' ) ) { remove_action( 'wp_head', 'wlwmanifest_link' ); } // -------------------------------------------------------------------------- // 15. Really Simple Discovery (RSD) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'rsd' ) ) { remove_action( 'wp_head', 'rsd_link' ); } // -------------------------------------------------------------------------- // 16. Short Link // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'shortlink' ) ) { remove_action( 'wp_head', 'wp_shortlink_wp_head' ); remove_action( 'template_redirect', 'wp_shortlink_header', 11 ); } // -------------------------------------------------------------------------- // 17. RSS Feeds // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'rss_feeds' ) ) { add_action( 'do_feed', 'disaexop_disable_feed', 1 ); add_action( 'do_feed_rdf', 'disaexop_disable_feed', 1 ); add_action( 'do_feed_rss', 'disaexop_disable_feed', 1 ); add_action( 'do_feed_rss2', 'disaexop_disable_feed', 1 ); add_action( 'do_feed_atom', 'disaexop_disable_feed', 1 ); remove_action( 'wp_head', 'feed_links', 2 ); remove_action( 'wp_head', 'feed_links_extra', 3 ); } /** Redirect feed requests to the homepage. */ function disaexop_disable_feed() { wp_safe_redirect( home_url(), 302 ); exit; } // -------------------------------------------------------------------------- // 18. REST API (block unauthenticated access) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'rest_api' ) ) { add_filter( 'rest_authentication_errors', function ( $result ) { if ( ! empty( $result ) ) { return $result; } if ( ! is_user_logged_in() ) { return new WP_Error( 'rest_disabled', esc_html__( 'REST API access is restricted to authenticated users.', 'abhishek-site-cleanup-controls' ), array( 'status' => 401 ) ); } return $result; } ); remove_action( 'wp_head', 'rest_output_link_wp_head' ); remove_action( 'template_redirect', 'rest_output_link_header', 11 ); } // -------------------------------------------------------------------------- // 19. Block Library CSS // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'block_library' ) ) { add_action( 'wp_enqueue_scripts', function () { wp_dequeue_style( 'wp-block-library' ); wp_dequeue_style( 'wp-block-library-theme' ); wp_dequeue_style( 'global-styles' ); }, 100 ); } // -------------------------------------------------------------------------- // 20. Application Passwords // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'application_passwords' ) ) { add_filter( 'wp_is_application_passwords_available', '__return_false' ); } // -------------------------------------------------------------------------- // 21. Privacy Tools // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'privacy_tools' ) ) { add_action( 'admin_menu', function () { remove_submenu_page( 'tools.php', 'export-personal-data.php' ); remove_submenu_page( 'tools.php', 'erase-personal-data.php' ); } ); } // -------------------------------------------------------------------------- // 22. Site Health Page // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'site_health' ) ) { add_action( 'admin_menu', function () { remove_submenu_page( 'tools.php', 'site-health.php' ); }, 99 ); } // -------------------------------------------------------------------------- // 23. Adjacent Posts Links // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'adjacent_posts' ) ) { remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 ); remove_action( 'wp_head', 'adjacent_posts_rel_link', 10 ); } // -------------------------------------------------------------------------- // 24. Version Query Var (?ver=) on assets // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'version_query_var' ) ) { add_filter( 'style_loader_src', 'disaexop_remove_ver_param', 9999 ); add_filter( 'script_loader_src', 'disaexop_remove_ver_param', 9999 ); } /** * Strip the ?ver= query parameter from asset URLs. * * @param string $src Asset URL. * @return string */ function disaexop_remove_ver_param( $src ) { return $src ? esc_url( remove_query_arg( 'ver', $src ) ) : $src; } // -------------------------------------------------------------------------- // 25. PDF Thumbnails // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'pdf_thumbnails' ) ) { add_filter( 'fallback_intermediate_image_sizes', '__return_empty_array' ); } // -------------------------------------------------------------------------- // 26. Empty Trash (shorten to 1 week) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'empty_trash' ) ) { add_filter( 'empty_trash_days', function () { return 7; } ); } // -------------------------------------------------------------------------- // 27. Plugin and Theme Editor // Note: DISALLOW_FILE_EDIT is a core constant ideally set in wp-config.php. // This toggle sets it at plugin runtime as a convenience, but wp-config.php // is the recommended approach for guaranteed effect. // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'file_editor' ) ) { if ( ! defined( 'DISALLOW_FILE_EDIT' ) ) { define( 'DISALLOW_FILE_EDIT', true ); } } // -------------------------------------------------------------------------- // 28. oEmbed // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'oembed' ) ) { remove_action( 'wp_head', 'wp_oembed_add_discovery_links' ); remove_action( 'wp_head', 'wp_oembed_add_host_js' ); add_filter( 'embed_oembed_discover', '__return_false' ); add_action( 'init', function () { global $wp_embed; if ( isset( $wp_embed ) ) { remove_filter( 'the_content', array( $wp_embed, 'autoembed' ), 8 ); } } ); } // -------------------------------------------------------------------------- // 29. Remote Block Patterns // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'remote_block_patterns' ) ) { add_filter( 'should_load_remote_block_patterns', '__return_false' ); } // -------------------------------------------------------------------------- // 30. Comments // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'comments' ) ) { add_action( 'admin_menu', function () { remove_menu_page( 'edit-comments.php' ); } ); add_action( 'init', function () { remove_post_type_support( 'post', 'comments' ); remove_post_type_support( 'page', 'comments' ); } ); add_filter( 'comments_open', '__return_false', 20, 2 ); add_filter( 'pings_open', '__return_false', 20, 2 ); add_filter( 'comments_array','__return_empty_array', 10, 2 ); add_action( 'wp_before_admin_bar_render', function () { global $wp_admin_bar; $wp_admin_bar->remove_menu( 'comments' ); } ); } // -------------------------------------------------------------------------- // 31. Post Revisions // Note: WP_POST_REVISIONS is a core constant ideally set in wp-config.php. // This toggle sets it at plugin runtime as a convenience. // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'post_revisions' ) ) { if ( ! defined( 'WP_POST_REVISIONS' ) ) { define( 'WP_POST_REVISIONS', false ); } } // -------------------------------------------------------------------------- // 32. Search // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'search' ) ) { add_action( 'template_redirect', function () { if ( is_search() ) { wp_safe_redirect( home_url(), 301 ); exit; } } ); add_filter( 'get_search_form', '__return_null' ); } // -------------------------------------------------------------------------- // 33. WP Login Logo โ enqueued via wp_add_inline_style (no raw echo) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'login_logo' ) ) { add_action( 'login_enqueue_scripts', function () { wp_register_style( 'disaexop-login', false, array(), DISAEXOP_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion wp_enqueue_style( 'disaexop-login' ); wp_add_inline_style( 'disaexop-login', '.login h1 a { display:none !important; }' ); } ); add_filter( 'get_site_icon_url', '__return_empty_string' ); } // -------------------------------------------------------------------------- // 34. Administration Email Verification Prompt // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'admin_email_verify' ) ) { add_filter( 'admin_email_check_interval', '__return_false' ); } // -------------------------------------------------------------------------- // 35. Right Click โ enqueued via wp_add_inline_script (no raw echo) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'right_click' ) ) { add_action( 'wp_enqueue_scripts', function () { wp_register_script( 'disaexop-nocontext', false, array(), DISAEXOP_VERSION, true ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion wp_enqueue_script( 'disaexop-nocontext' ); wp_add_inline_script( 'disaexop-nocontext', 'document.addEventListener("contextmenu",function(e){e.preventDefault();});' ); } ); } // ========================================================================== // WORDPRESS FEATURES (enable/disable core post type supports & features) // ========================================================================== // -------------------------------------------------------------------------- // 36. Thumbnails (Post Thumbnails / Featured Images) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'thumbnails' ) ) { add_action( 'after_setup_theme', function () { remove_theme_support( 'post-thumbnails' ); }, 99 ); } // -------------------------------------------------------------------------- // 37. Widgets // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'widgets' ) ) { add_action( 'widgets_init', function () { global $wp_widget_factory; if ( isset( $wp_widget_factory ) ) { $wp_widget_factory->widgets = array(); } }, 99 ); add_filter( 'sidebars_widgets', '__return_empty_array' ); } // -------------------------------------------------------------------------- // 38. Menus (Navigation Menus) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'menus' ) ) { add_action( 'after_setup_theme', function () { remove_theme_support( 'menus' ); }, 99 ); } // -------------------------------------------------------------------------- // 39. Tags // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'tags' ) ) { add_action( 'init', function () { unregister_taxonomy_for_object_type( 'post_tag', 'post' ); } ); add_action( 'admin_menu', function () { remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' ); } ); } // -------------------------------------------------------------------------- // 40. Categories // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'categories' ) ) { add_action( 'init', function () { unregister_taxonomy_for_object_type( 'category', 'post' ); } ); add_action( 'admin_menu', function () { remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=category' ); } ); } // -------------------------------------------------------------------------- // 41. Post Formats // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'post_formats' ) ) { add_action( 'after_setup_theme', function () { remove_theme_support( 'post-formats' ); }, 99 ); } // -------------------------------------------------------------------------- // 42. Custom Fields (post meta box in editor) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'custom_fields' ) ) { add_action( 'init', function () { remove_post_type_support( 'post', 'custom-fields' ); remove_post_type_support( 'page', 'custom-fields' ); } ); } // -------------------------------------------------------------------------- // 43. Excerpts // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'excerpts' ) ) { add_action( 'init', function () { remove_post_type_support( 'post', 'excerpt' ); remove_post_type_support( 'page', 'excerpt' ); } ); } // -------------------------------------------------------------------------- // 44. Trackbacks // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'trackbacks' ) ) { add_action( 'init', function () { remove_post_type_support( 'post', 'trackbacks' ); } ); } // -------------------------------------------------------------------------- // 45. Attachment Pages // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'attachment_pages' ) ) { add_action( 'template_redirect', function () { if ( is_attachment() ) { global $post; $url = $post ? wp_get_attachment_url( $post->ID ) : home_url(); wp_safe_redirect( $url ? $url : home_url(), 301 ); exit; } } ); } // -------------------------------------------------------------------------- // 46. Automatic Updates (core minor updates) // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'auto_updates' ) ) { add_filter( 'allow_minor_auto_core_updates', '__return_false' ); add_filter( 'allow_major_auto_core_updates', '__return_false' ); add_filter( 'auto_update_plugin', '__return_false' ); add_filter( 'auto_update_theme', '__return_false' ); } // -------------------------------------------------------------------------- // 47. Self Pings // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'self_pings' ) ) { add_action( 'pre_ping', function ( &$links ) { $home = home_url(); foreach ( $links as $key => $link ) { if ( strpos( $link, $home ) === 0 ) { unset( $links[ $key ] ); } } } ); } // -------------------------------------------------------------------------- // 48. jQuery Migrate // -------------------------------------------------------------------------- if ( disaexop_is_enabled( 'jquery_migrate' ) ) { add_action( 'wp_default_scripts', function ( $scripts ) { if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) { $script = $scripts->registered['jquery']; if ( $script->deps ) { $script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) ); } } } ); } // ========================================================================== // ADMIN UI // ========================================================================== // Suppress WordPress's auto settings-updated notice on our page. // We render our own inline badge inside the custom header instead. add_action( 'admin_init', function () { if ( isset( $_GET['page'] ) && // phpcs:ignore WordPress.Security.NonceVerification 'abhishek-site-cleanup-controls' === sanitize_key( wp_unslash( $_GET['page'] ) ) // phpcs:ignore WordPress.Security.NonceVerification ) { remove_all_actions( 'admin_notices' ); remove_all_actions( 'all_admin_notices' ); } } ); add_action( 'admin_menu', 'disaexop_register_settings_page' ); function disaexop_register_settings_page() { add_options_page( esc_html__( 'Site Cleanup Controls', 'abhishek-site-cleanup-controls' ), esc_html__( 'Site Cleanup Controls', 'abhishek-site-cleanup-controls' ), 'manage_options', 'abhishek-site-cleanup-controls', 'disaexop_render_settings_page' ); } add_action( 'admin_init', 'disaexop_register_settings' ); function disaexop_register_settings() { register_setting( 'disaexop_settings_group', DISAEXOP_OPTION_KEY, array( 'type' => 'array', 'sanitize_callback' => 'disaexop_sanitize_settings', 'default' => array(), ) ); } /** * Sanitize settings โ only allow known keys. * * @param mixed $input Raw POST input. * @return array */ function disaexop_sanitize_settings( $input ) { $clean = array(); if ( ! is_array( $input ) ) { return $clean; } foreach ( disaexop_feature_list() as $group ) { foreach ( $group['features'] as $key => $label ) { if ( ! empty( $input[ $key ] ) ) { $clean[ $key ] = 1; } } } return $clean; } // -------------------------------------------------------------------------- // Feature definitions // -------------------------------------------------------------------------- function disaexop_feature_list() { return array( 'security' => array( 'label' => esc_html__( 'Security', 'abhishek-site-cleanup-controls' ), 'icon' => '๐', 'features' => array( 'user_enumeration' => esc_html__( 'User Enumeration', 'abhishek-site-cleanup-controls' ), 'author_archives' => esc_html__( 'Author Archives', 'abhishek-site-cleanup-controls' ), 'xmlrpc' => esc_html__( 'XML-RPC + Pingback', 'abhishek-site-cleanup-controls' ), 'file_editor' => esc_html__( 'Plugin and Theme Editor', 'abhishek-site-cleanup-controls' ), 'application_passwords' => esc_html__( 'Application Passwords', 'abhishek-site-cleanup-controls' ), 'rest_api' => esc_html__( 'REST API (block unauthenticated)', 'abhishek-site-cleanup-controls' ), 'right_click' => esc_html__( 'Right Click (disable on frontend)', 'abhishek-site-cleanup-controls' ), ), ), 'performance' => array( 'label' => esc_html__( 'Performance', 'abhishek-site-cleanup-controls' ), 'icon' => 'โก', 'features' => array( 'emojis' => esc_html__( 'Emojis', 'abhishek-site-cleanup-controls' ), 'embeds' => esc_html__( 'Embed Objects', 'abhishek-site-cleanup-controls' ), 'dashicons' => esc_html__( 'Dashicons (frontend, non-logged-in)', 'abhishek-site-cleanup-controls' ), 'heartbeat' => esc_html__( 'Heartbeat', 'abhishek-site-cleanup-controls' ), 'block_library' => esc_html__( 'Block Library CSS', 'abhishek-site-cleanup-controls' ), 'version_query_var' => esc_html__( 'Version Var (?ver=) on Assets', 'abhishek-site-cleanup-controls' ), 'pdf_thumbnails' => esc_html__( 'PDF Thumbnails', 'abhishek-site-cleanup-controls' ), 'oembed' => esc_html__( 'oEmbed', 'abhishek-site-cleanup-controls' ), 'remote_block_patterns' => esc_html__( 'Remote Block Patterns', 'abhishek-site-cleanup-controls' ), ), ), 'head_cleanup' => array( 'label' => esc_html__( 'Head Cleanup', 'abhishek-site-cleanup-controls' ), 'icon' => '๐งน', 'features' => array( 'generator' => esc_html__( 'Generator Meta Tag', 'abhishek-site-cleanup-controls' ), 'wlw_manifest' => esc_html__( 'WLW Manifest', 'abhishek-site-cleanup-controls' ), 'rsd' => esc_html__( 'Really Simple Discovery (RSD)', 'abhishek-site-cleanup-controls' ), 'shortlink' => esc_html__( 'Short Link', 'abhishek-site-cleanup-controls' ), 'adjacent_posts' => esc_html__( 'Adjacent Posts Links', 'abhishek-site-cleanup-controls' ), 'rss_feeds' => esc_html__( 'RSS Feeds', 'abhishek-site-cleanup-controls' ), ), ), 'admin_cleanup' => array( 'label' => esc_html__( 'Admin Cleanup', 'abhishek-site-cleanup-controls' ), 'icon' => '๐ ๏ธ', 'features' => array( 'capital_p_dangit' => esc_html__( 'capital_P_dangit Filter', 'abhishek-site-cleanup-controls' ), 'screen_options_help' => esc_html__( 'Screen Options and Help Tabs', 'abhishek-site-cleanup-controls' ), 'howdy' => esc_html__( 'Howdy to Welcome in Admin Bar', 'abhishek-site-cleanup-controls' ), 'adminbar_nav' => esc_html__( 'Navigation Items in Admin Bar', 'abhishek-site-cleanup-controls' ), 'clean_dashboard' => esc_html__( 'Clean Dashboard (remove widgets)', 'abhishek-site-cleanup-controls' ), 'privacy_tools' => esc_html__( 'Privacy Tools (admin menu)', 'abhishek-site-cleanup-controls' ), 'site_health' => esc_html__( 'Site Health Page', 'abhishek-site-cleanup-controls' ), 'login_logo' => esc_html__( 'WP Login Logo and Favicon', 'abhishek-site-cleanup-controls' ), 'admin_email_verify' => esc_html__( 'Admin Email Verification Prompt', 'abhishek-site-cleanup-controls' ), 'empty_trash' => esc_html__( 'Empty Trash (shorten to 1 week)', 'abhishek-site-cleanup-controls' ), ), ), 'content' => array( 'label' => esc_html__( 'Content', 'abhishek-site-cleanup-controls' ), 'icon' => '๐', 'features' => array( 'comments' => esc_html__( 'Comments', 'abhishek-site-cleanup-controls' ), 'post_revisions' => esc_html__( 'Post Revisions', 'abhishek-site-cleanup-controls' ), 'search' => esc_html__( 'Search', 'abhishek-site-cleanup-controls' ), ), ), 'wp_features' => array( 'label' => esc_html__( 'WordPress Features', 'abhishek-site-cleanup-controls' ), 'icon' => 'โ๏ธ', 'features' => array( 'thumbnails' => esc_html__( 'Thumbnails / Featured Images', 'abhishek-site-cleanup-controls' ), 'widgets' => esc_html__( 'Widgets', 'abhishek-site-cleanup-controls' ), 'menus' => esc_html__( 'Navigation Menus', 'abhishek-site-cleanup-controls' ), 'tags' => esc_html__( 'Tags', 'abhishek-site-cleanup-controls' ), 'categories' => esc_html__( 'Categories', 'abhishek-site-cleanup-controls' ), 'post_formats' => esc_html__( 'Post Formats', 'abhishek-site-cleanup-controls' ), 'custom_fields' => esc_html__( 'Custom Fields (meta box)', 'abhishek-site-cleanup-controls' ), 'excerpts' => esc_html__( 'Excerpts', 'abhishek-site-cleanup-controls' ), 'trackbacks' => esc_html__( 'Trackbacks', 'abhishek-site-cleanup-controls' ), 'attachment_pages' => esc_html__( 'Attachment Pages', 'abhishek-site-cleanup-controls' ), 'auto_updates' => esc_html__( 'Automatic Updates (core, plugins, themes)', 'abhishek-site-cleanup-controls' ), 'self_pings' => esc_html__( 'Self Pings', 'abhishek-site-cleanup-controls' ), 'jquery_migrate' => esc_html__( 'jQuery Migrate (frontend)', 'abhishek-site-cleanup-controls' ), ), ), ); } // -------------------------------------------------------------------------- // Admin assets // -------------------------------------------------------------------------- add_action( 'admin_enqueue_scripts', 'disaexop_enqueue_assets' ); function disaexop_enqueue_assets( $hook ) { if ( 'settings_page_abhishek-site-cleanup-controls' !== $hook ) { return; } wp_enqueue_style( 'disaexop-admin', DISAEXOP_PLUGIN_URL . 'assets/admin.css', array(), DISAEXOP_VERSION ); wp_enqueue_script( 'disaexop-admin', DISAEXOP_PLUGIN_URL . 'assets/admin.js', array(), DISAEXOP_VERSION, true ); } // -------------------------------------------------------------------------- // Settings page render // -------------------------------------------------------------------------- function disaexop_render_settings_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $saved = isset( $_GET['settings-updated'] ) && '1' === sanitize_key( wp_unslash( $_GET['settings-updated'] ) ); // phpcs:ignore WordPress.Security.NonceVerification $settings = disaexop_get_settings(); ?>