/** * Kadence functions and definitions * * This file must be parseable by PHP 5.2. * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package kadence */ define( 'KADENCE_VERSION', '1.5.0' ); define( 'KADENCE_MINIMUM_WP_VERSION', '6.0' ); define( 'KADENCE_MINIMUM_PHP_VERSION', '7.4' ); // Bail if requirements are not met. if ( version_compare( $GLOBALS['wp_version'], KADENCE_MINIMUM_WP_VERSION, '<' ) || version_compare( phpversion(), KADENCE_MINIMUM_PHP_VERSION, '<' ) ) { require get_template_directory() . '/inc/back-compat.php'; return; } // Include WordPress shims. require get_template_directory() . '/inc/wordpress-shims.php'; // Load the `kadence()` entry point function. require get_template_directory() . '/inc/class-theme.php'; // Load the `kadence()` entry point function. require get_template_directory() . '/inc/functions.php'; // Initialize the theme. call_user_func( 'Kadence\kadence' ); // ------------------------------ 优化开始 ------------------------------ // // 修改登录页的 logo 图 function my_custom_login_logo() { echo ''; } add_action( 'login_head', 'my_custom_login_logo' ); // 关闭欢迎面板 add_action( 'load-index.php', 'remove_welcome_panel' ); function remove_welcome_panel(){ remove_action( 'welcome_panel', 'wp_welcome_panel' ); delete_user_meta( get_current_user_id(), 'show_welcome_panel' ); } // 关闭仪表盘模块 function remove_dashboard_widgets(){ // remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' ); // 关闭动态 remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' ); // 关闭概况 remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' ); // 关闭最新评论 remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' ); // 关闭链接 remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' ); // 关闭插件 remove_meta_box( 'dashboard_rediscache', 'dashboard', 'normal' ); // 关闭 redis-cache remove_meta_box( 'wpseo-dashboard-overview', 'dashboard', 'normal' ); // 关闭 Yoast SEO remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' ); // 关闭新建草稿 remove_meta_box( 'dashboard_primary', 'dashboard', 'side' ); // 关闭活动与新闻 remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' ); // 关闭其它新闻 remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); // 关闭快速发布 remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); // 关闭站点健康状态 } add_action( 'wp_dashboard_setup', 'remove_dashboard_widgets' ); // 关闭帮助菜单 add_action('in_admin_header', function(){ // 关闭帮助菜单 global $current_screen; $current_screen->remove_help_tabs(); }); // 关闭顶端菜单 function wphelp_remove_admin_menus( $wp_admin_bar ) { // $wp_admin_bar->remove_node( 'my-account' ); // 关闭我的账户 // $wp_admin_bar->remove_node( 'site-name' ); // 关闭站点名称 $wp_admin_bar->remove_node( 'wp-logo' ); // 关闭版权标识 $wp_admin_bar->remove_node( 'comments' ); // 关闭最新评论 $wp_admin_bar->remove_node( 'updates' ); // 关闭升级提醒 $wp_admin_bar->remove_node( 'customize' ); // 关闭个性定制 $wp_admin_bar->remove_node( 'new-content' ); // 关闭新建文章 $wp_admin_bar->remove_node( 'search' ); // 关闭站内搜索 } add_action( 'admin_bar_menu', 'wphelp_remove_admin_menus', 999 ); // 关闭左侧菜单 function my_admin_menu() { // remove_menu_page( 'index.php' ); // 关闭仪表盘 // remove_menu_page( 'themes.php' ); // 关闭外观 // remove_menu_page( 'edit.php' ); // 关闭文章 // remove_menu_page( 'upload.php' ); // 关闭媒体 // remove_menu_page( 'edit.php?post_type=page' ); // 关闭页面 remove_menu_page( 'plugins.php' ); // 关闭插件 remove_menu_page( 'tools.php' ); // 关闭工具 remove_menu_page( 'options-general.php' ); // 关闭设置 remove_menu_page( 'users.php' ); // 关闭用户 remove_menu_page( 'edit-comments.php' ); // 关闭评论 remove_menu_page( 'wpseo_dashboard' ); // 关闭 Yoast SEO remove_menu_page( 'wpfastestcacheoptions' ); // 关闭 WP Fastest Cache return true; } add_action( 'admin_menu', 'my_admin_menu', 20 ); // 关闭左侧菜单的子菜单 function remove_submenu() { remove_submenu_page( 'index.php', 'update-core.php' ); // 关闭仪表盘下的更新 remove_submenu_page( 'edit.php', 'post-new.php' ); // 关闭文章下的写文章 remove_submenu_page( 'upload.php', 'media-new.php' ); // 关闭媒体下的添加文件 remove_submenu_page( 'edit.php?post_type=page', 'post-new.php?post_type=page' ); // 关闭页面下的新页面 remove_submenu_page( 'themes.php', 'themes.php' ); // 关闭外观下的主题 remove_submenu_page( 'themes.php', 'site-editor.php?path=/patterns' ); // 关闭外观下的样板 remove_submenu_page( 'themes.php', 'kadence' ); // 关闭外观下的 kadence remove_submenu_page( 'tools.php','tools.php' ); // 关闭工具下的可用工具 // remove_submenu_page( 'tools.php','import.php' ); // 关闭工具下的导入 // remove_submenu_page( 'tools.php','export.php' ); // 关闭工具下的导出 remove_submenu_page( 'tools.php','site-health.php' ); // 关闭工具下的站点健康 remove_submenu_page( 'options-general.php','options-general.php' ); // 关闭设置下的常规 remove_submenu_page( 'options-general.php','options-writing.php' ); // 关闭设置下的撰写 remove_submenu_page( 'options-general.php','options-reading.php' ); // 关闭设置下的阅读 remove_submenu_page( 'options-general.php','options-media.php' ); // 关闭设置下的媒体 remove_submenu_page( 'options-general.php','options-discussion.php' ); // 关闭设置下的讨论 remove_submenu_page( 'options-general.php','options-privacy.php' ); // 关闭设置下的隐私 remove_submenu_page( 'options-general.php','options-permalink.php' ); // 关闭设置下的固定链接 remove_submenu_page( 'options-general.php','redis-cache' ); // 关闭设置下的 redis-cache remove_submenu_page( 'wpseo_dashboard','wpseo_dashboard' ); // 关闭 Yoast SEO 下的常规 // remove_submenu_page( 'wpseo_dashboard','wpseo_page_settings' ); // 关闭 Yoast SEO 下的设置 remove_submenu_page( 'wpseo_dashboard','wpseo_integrations' ); // 关闭 Yoast SEO 下的集成 // remove_submenu_page( 'wpseo_dashboard','wpseo_tools' ); // 关闭 Yoast SEO 下的工具 remove_submenu_page( 'wpseo_dashboard','wpseo_page_academy' ); // 关闭 Yoast SEO 下的 Academy remove_submenu_page( 'wpseo_dashboard','wpseo_licenses' ); // 关闭 Yoast SEO 下的 Upgrades remove_submenu_page( 'wpseo_dashboard','wpseo_workouts' ); // 关闭 Yoast SEO 下的 Workouts remove_submenu_page( 'wpseo_dashboard','wpseo_redirects' ); // 关闭 Yoast SEO 下的 Redirects remove_submenu_page( 'wpseo_dashboard','wpseo_page_support' ); // 关闭 Yoast SEO 下的支持 } if ( is_admin() ) { add_action( 'admin_init','remove_submenu' ); } // 关闭底部信息 function change_footer_admin () {return '';} add_filter( 'admin_footer_text', 'change_footer_admin', 9999 ); // 关闭登录欢迎语 function change_footer_version() {return '';} add_filter( 'update_footer', 'change_footer_version', 9999 ); // 关闭版权信息 // 关闭隐私设置 add_filter( 'map_meta_cap', 'ds_disable_core_privacy_tools', 10, 2 ); remove_action( 'init', 'wp_schedule_delete_old_privacy_export_files' ); remove_action( 'wp_privacy_delete_old_export_files', 'wp_privacy_delete_old_export_files' ); function ds_disable_core_privacy_tools( $caps, $cap ) { switch ( $cap ) { case 'export_others_personal_data': case 'erase_others_personal_data': case 'manage_privacy_options': $caps[] = 'do_not_allow'; break; } return $caps; } // 关闭站点健康 function disable_site_health_check() { remove_action( 'admin_notices', 'site_health_notification' ); } add_action( 'admin_init', 'disable_site_health_check' ); // 关闭自动保存 function disable_autosave() { wp_deregister_script( 'autosave' ); } add_action( 'wp_print_scripts', 'disable_autosave' ); // 关闭修订版本 add_filter( 'wp_revisions_to_keep', 'fanly_wp_revisions_to_keep', 10, 2 ); function fanly_wp_revisions_to_keep( $num, $post ) { return 0; } // ------------------------------ 优化结束 ------------------------------ // // ------------------------------ 系统更新 ------------------------------ // // 关闭系统更新 remove_action( 'admin_init','_maybe_update_core' ); remove_action( 'admin_init','_maybe_update_plugins' ); remove_action( 'admin_init','_maybe_update_themes' ); remove_action( 'load-plugins.php', 'wp_update_plugins' ); remove_action( 'load-update.php', 'wp_update_plugins' ); remove_action( 'load-update-core.php', 'wp_update_plugins' ); remove_action( 'load-themes.php', 'wp_update_themes' ); remove_action( 'load-update.php', 'wp_update_themes' ); remove_action( 'load-update-core.php', 'wp_update_themes' ); remove_action( 'init', 'wp_schedule_update_checks' ); wp_clear_scheduled_hook( 'wp_version_check' ); wp_clear_scheduled_hook( 'wp_update_plugins' ); wp_clear_scheduled_hook( 'wp_update_themes' ); wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); // === 品牌清理 === // 移除 wp_generator remove_action('wp_head', 'wp_generator'); add_filter('the_generator', '__return_empty_string'); // 后台/登录页标题品牌清理 add_filter('admin_title', function($admin_title, $title) { return str_replace(' — WordPress', ' — syln.cn', $admin_title); }, 10, 2); add_filter('login_title', function($login_title) { return str_replace(' — WordPress', ' — syln.cn', $login_title); }); add_filter("style_loader_src", function($x) { return $x ? remove_query_arg("ver", $x) : $x; }); add_filter("script_loader_src", function($x) { return $x ? remove_query_arg("ver", $x) : $x; }); remove_action("wp_head", "rsd_link"); remove_action("wp_head", "wlwmanifest_link"); remove_action("wp_head", "feed_links_extra", 3); remove_action("wp_head", "feed_links", 2); remove_action("wp_head", "index_rel_link"); remove_action("wp_head", "start_post_rel_link", 10); remove_action("wp_head", "parent_post_rel_link", 10); remove_action("wp_head", "adjacent_posts_rel_link", 10); remove_action("wp_head", "wp_shortlink_wp_head"); add_filter("wp_headers", function($h) { unset($h["X-Pingback"]); return $h; }); https://syln.cn/category/liaoning-travel/ 2026-06-16T03:18:44+00:00 https://syln.cn/category/chinese-culture/ 2024-12-05T12:33:22+00:00 https://syln.cn/category/liaoning-news/ 2026-06-12T14:13:53+00:00 https://syln.cn/category/chinese-hero/ 2024-11-26T02:15:13+00:00 https://syln.cn/category/liaoning-food/ 2026-06-16T03:18:44+00:00 https://syln.cn/category/liaoning-video/ 2026-06-16T03:18:44+00:00 https://syln.cn/category/shenyang-story/ 2026-06-14T09:49:02+00:00 https://syln.cn/category/syln/ 2024-11-29T05:03:58+00:00 https://syln.cn/category/liaoning-culture/ 2026-06-14T09:49:03+00:00