WordPress支持webp格式图片

将如下代码加入主题的functions.php或自己建立个插件写入内容

//让WORDPRESS支持WEBP格式图片
function webp_images_mime_types( $result ) {
    $result['webp'] = 'image/webp';
    return $result;
}

function webp_images_displayable($result, $path) {
    $info = @getimagesize( $path );
    if($info['mime'] == 'image/webp') {
        $result = true;
    }
    return $result;
}

add_filter( 'mime_types', 'webp_images_mime_types', 10, 1 );
add_filter( 'file_is_displayable_image', 'webp_images_displayable', 10, 2 );

解决WP“此响应不是合法的JSON响应。”

WordPress后台在5.X里新增加的古腾堡编辑器(Gutenberg)也许是太亲近大多数用户了,第一,很多功能其实找起来并不方便,其次,问题很多,例如大多数臃肿,兼容等问题,例如:

此响应不是合法的JSON响应。

还有发布文章时:

发布失败。此响应不是合法的JSON响应。

所以想用回原有编辑器,可以将以下代码放置在主题functions.php或者自己写个小插件(适合频繁更换主题或者使用商用主题的人)内:

//Wordpress 5.0+ 禁用 Gutenberg 编辑器
add_filter('use_block_editor_for_post', '__return_false');
remove_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );

补充:古腾堡编辑器出现上述提示的原因还有可能是你服务器部分文件不可写,自动保存,还有REST API问题(查询一下是否做了屏蔽)等。但这些问题建议都先查询伪静态是否做好,尤其nginx环境。

查看REST API是否开着的方法:访问//你网站域名/wp-json/,看是否能打开整个页面的json,如果只有1行,就是被关闭了。

以下是可能造成屏蔽REST API的代码

add_filter('json_enabled', '__return_false');
add_filter('json_jsonp_enabled', '__return_false');
add_filter('rest_enabled', '__return_false');
add_filter('rest_jsonp_enabled', '__return_false');

remove_action('wp_head', 'rest_output_link_wp_head', 10);
remove_action('template_redirect', 'rest_output_link_header', 11);

禁用wordpress后台的健康检测

服务器健康检测应该是很多用wordpress用户现在很郁闷的地方,总是有几个改善信息,但由于种种原因没办法彻底去掉,或者不会去掉

下面就帮助各位强迫症解决这个问题

以下代码源自Site Health Tool Manager插件,添加至主题functions.php或者自己写个小插件内,后台的健康检测一下全绿

/* 屏蔽 健康检测 */
function rm_site_health( $sitehealth ) {
unset( $sitehealth['direct']['php_version'] );
unset( $sitehealth['direct']['wordpress_version'] );
unset( $sitehealth['direct']['plugin_version'] );
unset( $sitehealth['direct']['theme_version'] );
unset( $sitehealth['direct']['sql_server'] );
unset( $sitehealth['direct']['php_extensions'] );
unset( $sitehealth['direct']['php_default_timezone'] );
unset( $sitehealth['direct']['php_sessions'] );
unset( $sitehealth['direct']['utf8mb4_support'] );
unset( $sitehealth['direct']['https_status'] );
unset( $sitehealth['direct']['ssl_support'] );
unset( $sitehealth['direct']['scheduled_events'] );
unset( $sitehealth['direct']['http_requests'] );
unset( $sitehealth['direct']['is_in_debug_mode'] );
unset( $sitehealth['direct']['dotorg_communication'] );
unset( $sitehealth['direct']['background_updates'] );
unset( $sitehealth['direct']['loopback_requests'] );
unset( $sitehealth['direct']['rest_availability'] );
return $sitehealth;
}
add_filter( 'site_status_tests', 'rm_site_health' );

更新说明

WordPress 4.3.1修复两个跨站点脚本漏洞补丁(cve-2015-5714,cve-2015-5715)和一个潜在的特权升级漏洞。
除了安全补丁,还修复了26处 4.3包含的错误

文件更新列表

readme.html
wp-admin/about.php
wp-admin/css/forms-rtl.css
wp-admin/css/forms.css
wp-admin/css/list-tables-rtl.css
wp-admin/css/list-tables.css
wp-admin/css/login-rtl.min.css
wp-admin/css/login.min.css
wp-admin/css/wp-admin-rtl.min.css
wp-admin/css/wp-admin.min.css
wp-admin/includes/class-wp-filesystem-ssh2.php
wp-admin/includes/class-wp-ms-users-list-table.php
wp-admin/includes/class-wp-users-list-table.php
wp-admin/includes/template.php
wp-admin/includes/upgrade.php
wp-admin/includes/user.php
wp-admin/includes/version.php
wp-admin/js/customize-controls.js
wp-admin/js/customize-controls.min.js
wp-admin/js/customize-nav-menus.js
wp-admin/js/customize-nav-menus.min.js
wp-admin/js/edit-comments.js
wp-admin/js/edit-comments.min.js
wp-admin/js/user-profile.js
wp-admin/js/user-profile.min.js
wp-admin/network/site-new.php
wp-admin/network/site-users.php
wp-admin/network/user-new.php
wp-admin/network/users.php
wp-includes/category-template.php
wp-includes/class-wp-xmlrpc-server.php
wp-includes/default-widgets.php
wp-includes/formatting.php
wp-includes/js/tinymce/plugins/charmap/plugin.js
wp-includes/js/tinymce/plugins/charmap/plugin.min.js
wp-includes/js/tinymce/plugins/lists/plugin.js
wp-includes/js/tinymce/plugins/media/plugin.js
wp-includes/js/tinymce/plugins/media/plugin.min.js
wp-includes/js/tinymce/plugins/paste/plugin.js
wp-includes/js/tinymce/plugins/paste/plugin.min.js
wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
wp-includes/js/tinymce/plugins/wpeditimage/plugin.min.js
wp-includes/js/tinymce/plugins/wplink/plugin.js
wp-includes/js/tinymce/plugins/wplink/plugin.min.js
wp-includes/js/tinymce/plugins/wpview/plugin.js
wp-includes/js/tinymce/plugins/wpview/plugin.min.js
wp-includes/js/tinymce/skins/lightgray/content.inline.min.css
wp-includes/js/tinymce/skins/lightgray/content.min.css
wp-includes/js/tinymce/skins/lightgray/skin.ie7.min.css
wp-includes/js/tinymce/skins/lightgray/skin.min.css 
wp-includes/js/tinymce/themes/modern/theme.js
wp-includes/js/tinymce/themes/modern/theme.min.js
wp-includes/js/tinymce/tinymce.min.js 
wp-includes/js/tinymce/wp-tinymce.js.gz
wp-includes/js/wp-ajax-response.js
wp-includes/js/wp-ajax-response.min.js
wp-includes/media.php
wp-includes/pluggable.php
wp-includes/shortcodes.php
wp-includes/taxonomy.php
wp-includes/user.php
wp-includes/version.php
wp-includes/widgets.php
wp-includes/wp-db.php


继续阅读

WordPress于2015年5月7日更新4.2.2,修复若干BUG

In addition to the security fixes, WordPress 4.2.2 contains fixes for 13 bugs from 4.2.1, including:

  • Fixes an emoji loading error in IE9 and IE10
  • Fixes a keyboard shortcut for saving from the Visual editor on Mac
  • Fixes oEmbed for YouTube URLs to always expect https
  • Fixes how WordPress checks for encoding when sending strings to MySQL
  • Fixes a bug with allowing queries to reference tables in the dbname.tablename format
  • Lowers memory usage for a regex checking for UTF-8 encoding
  • Fixes an issue with trying change the wrong index in the wp_signups table on utf8mb4 conversion
  • Improves performance of loop detection in _get_term_children()
  • Fixes a bug where attachment URLs were incorrectly being forced to use https in some contexts

翻译:

  1. 修复IE9和IE10的表情符号加载错误
  2. 修复Mac上的可视化编辑器键盘快捷键保存错误
  3. 修复YouTube的视频地址总是采用HTTPS的错误
  4. 修复发送MySQL字符串时WordPress的检查编码BUG
  5. 修复允许在dbname.tablename格式查询参考表的BUG
  6. 降低了使用正则表达式检查UTF-8编码时的内存占用
  7. 修复wp_signups表索引utf8mb4转换错误的问题
  8. 改善循环检测_get_term_children的性能()
  9. 修复了在某些情况下使用https,附件URL的错误

受影响文件

wp-admin/js/editor-expand.js
wp-admin/about.php
wp-admin/includes/update-core.php
wp-admin/includes/upgrade.php
wp-includes/taxonomy.php
wp-includes/compat.php
wp-includes/version.php
wp-includes/post.php
wp-includes/js/wp-emoji.js
wp-includes/js/wp-emoji-loader.js
wp-includes/js/tinymce/tiny_mce_popup.js
wp-includes/js/tinymce/tinymce.min.js
wp-includes/js/tinymce/plugins/wordpress/plugin.js
wp-includes/js/tinymce/tinymce.js
wp-includes/comment.php
wp-includes/wp-db.php
wp-includes/pluggable.php
wp-content/themes/twentyfifteen/genericons/example.html (deleted)
wp-content/themes/twentythirteen/genericons/example.html (deleted)
wp-content/themes/twentyfourteen/genericons/example.html (deleted)
readme.html

WordPress 4.2版于2015年4月24日清晨更新

Wordpress 4.2版于2015年4月24日清晨更新

更方便地共享内容

收藏、编辑、发布,向您介绍最新的”按这里“工具。在工具菜单中,将”按这里“加入到您的浏览器书签或移动设备主屏幕,然后您就可以迅雷不及掩耳地共享您的内容。共享您喜欢的视频、图片和内容从来没有像现在这样简单快捷。

将下面的浏览器书签拖动到您的书签栏,然后,当您发现想要共享的页面时,“按”它。

继续阅读WordPress 4.2版于2015年4月24日清晨更新