社区应用 最新帖子 精华区 社区服务 会员列表 统计排行
  • 982阅读
  • 4回复

[系统软件]WordPress V5.7.0 官方简体中文正式版发布!

楼层直达
z3960 
级别: FLY版主
发帖
786690
飞翔币
211594
威望
215717
飞扬币
2617541
信誉值
8


WordPress,全球广泛使用的知名免费开源网站博客程序。WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的服务器上架设自己的网站,也可以把WordPress 当作一个内容管理系统(CMS)来使用。WordPress 还是一个免费的开源项目,在GNU通用公共许可证下授权发布。

新版特性
https://wordpress.org/news/
2021.02.03 WordPress 5.6.1 正式版
2021年的第一个WordPress新版本命名“ Esperanza”,以纪念现代音乐神童Esperanza Spalding的名字命名。她作为音乐家的道路千变万化,充满灵感-进一步了解她, 并聆听她的音乐!- 新的WordPress仪表板配色方案
– 新的文章编辑器新增一些编辑按钮
– 现在支持一键将站点从HTTP强制转换HTTPS,切换时将自动更新数据库链接。
– 新的Robots API,默认robots.txt里有阻止蜘蛛爬取某页面时,并且启用了max-image-preview: large,搜索引擎则可以显示更大的图像预览
– 延迟加载框架,默认情况loading=”lazy” 指定了宽高度时,新版将向广告代码求添加属性
– 前端公用库更新到jQuery 3.5.1 版本,新版后jQuery在控制台的消息更少,以后将更安全
系统要求
v5.x 最低系统环境需求
PHP 5.6.20或更高版本
MySQL 5.0或更高版本
下载地址

WordPress v5.7 官方简体中文正式版 [2021/03/15]
https://cn.wordpress.org/download/releases
https://cn.wordpress.org/wordpress-5.7-zh_CN.zip
https://cn.wordpress.org/wordpress-5.7-zh_CN.tar.gz

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', create_function('$a', "return null;"));//禁止后台显示插件升级提示add_filter('pre_site_transient_update_plugins', create_function('$a', "return null;"));//禁止后台显示主题升级提示add_filter('pre_site_transient_update_themes', create_function('$a', "return null;"));//关闭WordPress的XML-RPC功能(建议清空网站根目录下下xmlrpc.php内容)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;}//替换前端公共库jQuery到国内,加快后台访问function my_modify_jquery() {if (!is_admin()) {wp_deregister_script('jquery');wp_deregister_script('jquery-form');wp_register_script('jquery', ('https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js'), false, null, true);wp_register_script('jquery-form', ('https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.min.js'), array(jquery), null, true);}}//禁止WordPress新版本头部加载s.w.org境外域名function remove_dns_prefetch( $hints, $relation_type ) {if ( 'dns-prefetch' === $relation_type ) {return array_diff( wp_dependencies_unique_hosts(), $hints );}return $hints;}add_filter( 'wp_resource_hints', 'remove_dns_prefetch', 10, 2 );//解决后台加载ajax.googleapis无法访问function hc_cdn_callback($buffer) {return str_replace('ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css', 'cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min.css', $buffer);}function hc_buffer_start() {ob_start("hc_cdn_callback");}function izt_buffer_end() {ob_end_flush();}add_action('init', 'hc_buffer_start');add_action('shutdown', 'hc_buffer_end');//减少后台admin-ajax.php加载时间的方法add_action( 'init', 'my_deregister_heartbeat', 1 );function my_deregister_heartbeat() {global $pagenow;if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow )wp_deregister_script('heartbeat');}//替换评论用户头像链接为国内镜像加速访问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/'], 'sdn.geekzu.org/avatar/', $avatar);});//删除头部冗余代码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' );//删除WordPress新版本站点健康状态面板和菜单项add_action( 'admin_menu', 'remove_site_health_menu' );function remove_site_health_menu(){remove_submenu_page( 'tools.php','site-health.php' );}//切换经典文章编辑器(v5.x开始默认古腾堡编辑器)add_filter('use_block_editor_for_post', '__return_false');//禁止WordPress新版本文章编辑器前端加载样式文件remove_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );//自动给所有文章的外部链接添加nofollow属性(有助于SEO方面)add_filter('the_content','the_content_nofollow',999);function the_content_nofollow($content){preg_match_all('/href="(.*?)" rel="external nofollow" /',$content,$matches);if($matches){foreach($matches[1] as $val){if( strpos($val,home_url())===false ) $content=str_replace("href=\"$val\"", "href=\"$val\" rel=\"external nofollow\" ",$content);}}return $content;}/*发布文章主动推送到百度,加快收录保护原创【WordPress通用方式】*/if(!function_exists('Baidu_Submit')){function Baidu_Submit($post_ID) {$WEB_TOKEN = 'NnplUN8E869njUwr'; //这里请换成你的网站的百度主动推送的token值$WEB_DOMAIN = get_option('home');//已成功推送的文章不再推送if(get_post_meta($post_ID,'Baidusubmit',true) == 1) return;$url = get_permalink($post_ID);$api = 'http://data.zz.baidu.com/urls?site='.$WEB_DOMAIN.'&token='.$WEB_TOKEN;$request = new WP_Http;$result = $request->request( $api , array( 'method' => 'POST', 'body' => $url , 'headers' => 'Content-Type: text/plain') );$result = json_decode($result['body'],true);//如果推送成功则在文章新增自定义栏目Baidusubmit,值为1if (array_key_exists('success',$result)) {add_post_meta($post_ID, 'Baidusubmit', 1, true);}}add_action('publish_post', 'Baidu_Submit', 0);}//文章插入图片自动移除 img 的 width、height、class 属性;add_filter( 'post_thumbnail_html', 'fanly_remove_images_attribute', 10 );add_filter( 'image_send_to_editor', 'fanly_remove_images_attribute', 10 );function fanly_remove_images_attribute( $html ) {//$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );$html = preg_replace( '/width="(\d*)"\s+height="(\d*)"\s+class="[^"]*"/', "", $html );$html = preg_replace( '/ /', "", $html );return $html;}// 自适应图片删除width和heightfunction ludou_remove_width_height_attribute($content){preg_match_all('/<[img|IMG].*?src=[\'|"](.*?(?:[\.gif|\.jpg|\.png\.bmp]))[\'|"].*?[\/]?>/', $content, $images);if(!empty($images)) {foreach($images[0] as $index => $value){$new_img = preg_replace('/(width|height)="\d*"\s/', "", $images[0][$index]);$content = str_replace($images[0][$index], $new_img, $content);}}return $content;}/* 删除文章时删除图片附件 */function delete_post_and_attachments($post_ID) {global $wpdb;// 删除图片附件$attachments = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_parent = $post_ID AND post_type = 'attachment'" );foreach ( $attachments as $attachment ) {wp_delete_attachment( $attachment->ID, true );}$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND post_id = $post_ID" );}add_action('before_delete_post', 'delete_post_and_attachments');
关键词: 中文 Word
我不喜欢说话却每天说最多的话,我不喜欢笑却总笑个不停,身边的每个人都说我的生活好快乐,于是我也就认为自己真的快乐。可是为什么我会在一大群朋友中突然地就沉默,为什么在人群中看到个相似的背影就难过,看见秋天树木疯狂地掉叶子我就忘记了说话,看见天色渐晚路上暖黄色的灯火就忘记了自己原来的方向。
级别: 光盘高级
发帖
20368
飞翔币
1247
威望
142
飞扬币
203670
信誉值
0

只看该作者 1 发表于: 2021-03-15
进来看看
级别: 光盘高级
发帖
20368
飞翔币
1247
威望
142
飞扬币
203670
信誉值
0

只看该作者 2 发表于: 2021-03-15
谢谢分享
级别: 超级版主
发帖
884020
飞翔币
253155
威望
224883
飞扬币
2708258
信誉值
0

只看该作者 3 发表于: 2021-03-16
支持一下了
级别: 超级版主
发帖
884020
飞翔币
253155
威望
224883
飞扬币
2708258
信誉值
0

只看该作者 4 发表于: 2021-03-16
谢谢分享