-
UID:17777
-
- 注册时间2007-05-02
- 最后登录2025-05-04
- 在线时间18637小时
-
- 发帖786346
- 搜Ta的帖子
- 精华0
- 飞翔币211574
- 威望215717
- 飞扬币2615712
- 信誉值8
-
访问TA的空间加好友用道具
- 发帖
- 786346
- 飞翔币
- 211574
- 威望
- 215717
- 飞扬币
- 2615712
- 信誉值
- 8
|
WordPress,全球广泛使用的知名 免费开源网站博客程序。WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的 服务器上架设自己的网站,也可以把WordPress 当作一个内容管理 系统(CMS)来使用。WordPress 还是一个免费的开源项目,在GNU通用公共许可证下授权发布。 WordPress新版必备优化代码:<!--优化代码添加到主题目录functions.php文件--!> /*彻底关闭自动更新(核心程序/主题/插件/翻译自动更新*/add_filter('automatic_updater_disabled', '__return_true');/*关闭更新检查定时作业*/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');/*移除后台内核更新检查*/remove_action( 'admin_init', '_maybe_update_core' );/*移除后台插件更新检查*/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( 'admin_init', '_maybe_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( 'admin_init', '_maybe_update_themes' );/*关闭程序更新提示*/add_filter( 'pre_site_transient_update_core', function($a){ return null; });/*关闭插件更新提示*/add_filter('pre_site_transient_update_plugins', function($a){return null;});/*关闭主题更新提示*/add_filter('pre_site_transient_update_themes', function($a){return null;});//关闭WordPress的XML-RPC功能add_filter('xmlrpc_enabled', '__return_false');//关闭XML-RPC的 pingback端口add_filter( 'xmlrpc_methods', 'remove_xmlrpc_pingback_ping' );function remove_xmlrpc_pingback_ping( $methods ) {unset( $methods['pingback.ping'] );return $methods;}//移除前端网页源代码内的头部冗余代码remove_action( 'wp_head', 'feed_links_extra', 3 );remove_action( 'wp_head', 'rsd_link' );remove_action( 'wp_head', 'wlwmanifest_link' );remove_action( 'wp_head', 'index_rel_link' );remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );remove_action( 'wp_head', 'wp_generator' );//移除新版本站点健康状态面板和菜单项add_action( 'admin_menu', 'remove_site_health_menu' );function remove_site_health_menu(){remove_submenu_page( 'tools.php','site-health.php' );}//禁用5.5版后自带的XML站点地图add_filter( 'wp_sitemaps_enabled', '__return_false' );//移除后台仪表盘站点健康状态面板add_action('wp_dashboard_setup', 'remove_site_health_dashboard_widget');function remove_site_health_dashboard_widget(){remove_meta_box('dashboard_site_health', 'dashboard', 'normal');}//移除后台仪表盘菜单:站点健康状态add_action( 'admin_menu', 'remove_site_health_menu' );function remove_site_health_menu(){remove_submenu_page( 'tools.php','site-health.php' );}//移除后台仪表盘菜单:活动、新闻function bzg_remove_dashboard_widgets() {global $wp_meta_boxes;#移除 "活动"unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);#移除 "WordPress 新闻"unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);}add_action('wp_dashboard_setup', 'bzg_remove_dashboard_widgets' );//移除后台仪表盘菜单:帮助function bzg_remove_help() {get_current_screen()->remove_help_tabs();}add_action('admin_head', 'bzg_remove_help');//移除后台页面title标题的wordpress后缀add_filter('admin_title', 'delAdminTitle', 10, 2);function delAdminTitle($admin_title, $title){return $title.' ‹ '.get_bloginfo('name');}//移除登陆页面title标题的wordpress后缀add_filter('login_title', 'remove_login_title', 10, 2);function remove_login_title($login_title, $title){return $title.' ‹ '.get_bloginfo('name');}//切换经典文章编辑器(v5.x开始默认古腾堡编辑器)add_filter('use_block_editor_for_post', '__return_false');//禁止WordPress新版本文章编辑器前端加载样式文件remove_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );//替换评论用户头像链接为国内镜像加速访问add_filter('get_avatar', function ($avatar) {return str_replace(['www.gravatar.com/avatar/','0.gravatar.com/avatar/','1.gravatar.com/avatar/','2.gravatar.com/avatar/','secure.gravatar.com/avatar/','cn.gravatar.com/avatar/'], 'gravatar.wp-china-yes.net/', $avatar);});新版变化News & Announcements – WordPress.org https://wordpress.org/news/v5.8.1 修正60个错误,修复3个 安全漏洞,3个安全漏洞全都与区块编辑器有关,建议升级。 这只个安全维护版本,5.9版本将于12月份发布。 系统要求v5.x 最低系统环境需求 PHP 5.6.20或更高版本,建议7.2稳定版 MySQL 5.6或更高版本,建议5.6.50稳定版 下载地址WordPress 5.8.1 官方简体 中文正式版 [2021/09/09] https://cn.wordpress.org/download/releaseshttps://cn.wordpress.org/wordpress-5.8.1-zh_CN.ziphttps://cn.wordpress.org/wordpress-5.8.1-zh_CN.tar.gz
|