Wordpress禁用文章修订版本
Wordpress禁用文章修订版本
Function代码
//禁用文章修订版本,by minirizhi.com
add_filter( 'wp_revisions_to_keep', 'minirizhi_wp_revisions_to_keep', 10, 2 );
function minirizhi_wp_revisions_to_keep( $num, $post ) {
return 0;
} Wordpress禁用文章修订版本
//禁用文章修订版本,by minirizhi.com
add_filter( 'wp_revisions_to_keep', 'minirizhi_wp_revisions_to_keep', 10, 2 );
function minirizhi_wp_revisions_to_keep( $num, $post ) {
return 0;
} Wordpress禁用文章自动保存
//禁用文章自动保存,by minirizhi.com
add_action('wp_print_scripts','disable_autosave');
function disable_autosave(){
wp_deregister_script('autosave');
} Wordpress禁止加载自带的jquery.js
//禁止加载WP自带的jquery.js,by minirizhi.com
if ( !is_admin() ) { // 后台不禁止
function minirizhi_init_method() {
wp_deregister_script( 'jquery' ); // 取消原有的 jquery 定义
}
add_action('init', 'minirizhi_init_method');
}
wp_deregister_script( 'l10n' ); Wordpress移除不必要的头部信息
// 移除不必要的头部信息,by minirizhi.com
remove_action( 'wp_head', 'feed_links', 2 ); //移除feed
remove_action( 'wp_head', 'feed_links_extra', 3 ); //移除feed
remove_action( 'wp_head', 'rsd_link' ); //移除离线编辑器开放接口
remove_action( 'wp_head', 'wlwmanifest_link' ); //移除离线编辑器开放接口
remove_action( 'wp_head', 'index_rel_link' );//去除本页唯一链接信息
remove_action('wp_head', 'parent_post_rel_link', 10, 0 );//清除前后文信息
remove_action('wp_head', 'start_post_rel_link', 10, 0 );//清除前后文信息
remove_action( 'wp_head', 'wp_generator' ); //移除WordPress版本
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10);
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 ); //删除 head 中的 shortlink
remove_action( 'wp_head', 'rest_output_link_wp_head', 10); // 删除头部输出 WP RSET API 地址
remove_action( 'template_redirect','wp_shortlink_header', 11); //禁止短链接 Header 标签。
remove_action( 'template_redirect', 'rest_output_link_header', 11); // 禁止输出 Header Link 标签。
Wordpress移除 Admin Bar
//移除 WordPress 的 Admin Bar,by minirizhi.com
add_filter('show_admin_bar', '__return_false'); Wordpress移除自动修正大小写函数
//移除 WordPress 自动修正 WordPress 大小写函数,by minirizhi.com
remove_filter( 'the_content', 'capital_P_dangit', 11 );
remove_filter( 'the_title', 'capital_P_dangit', 11 );
remove_filter( 'wp_title', 'capital_P_dangit', 11 );
remove_filter( 'comment_text', 'capital_P_dangit', 31 );