下面的方法需要修改源文件所以在打开每一个文件之前,记得一定要先做好备份!
禁用文章修订历史版本
1.打开 wp-config.php 文件
2.在 $table_prefix = \\’wp_\\’; 前面添加下面的两行代码:
define(\\'WP_POST_REVISIONS\\', false);//禁用历史修订版本
define(\\'AUTOSAVE_INTERVAL\\', false);//自动保存时间设置为一天
如下:
禁用自动保存功能
1.打开 wp-admin/post.php 文件,搜索 if ( \\’attachment\\’ !== $post_type ) ,找到以下代码 150-151行
if ( \\'attachment\\' !== $post_type )
wp_enqueue_script(\\'autosave\\');
将这两行用注释符号//注释即可!如下:
2.打开 wp-admin/post-new.php 文件,搜索 wp_enqueue_script( \\’autosave\\’ ); (69行),在代码前面加//将其注释或删除
禁用自动草稿功能
打开 wp-adminincludespost.php 文件,搜索 if ( $create_in_db ) { 找到以下代码 597行
$post_id = wp_insert_post( array( \\'post_title\\' => __( \\'Auto Draft\\' ), \\'post_type\\' =>
$post_type, \\'post_status\\' => \\'auto-draft\\' ) ); $post = get_post( $post_id );
修改为:
global $current_user,$wpdb; $post = $wpdb->get_row( "SELECT * FROM $wpdb->posts WHERE post_status = \\'auto-draft\\' AND post_type = \\'$post_type\\' AND post_author = $current_user->ID ORDER BY ID ASC LIMIT 1" ); if (!($post) ) { $post_id = wp_insert_post( array( \\'post_title\\' => __( \\'Auto Draft\\' ), \\'post_type\\' => $post_type, \\'post_status\\' => \\'auto-draft\\' ) ); $post = get_post( $post_id ); }
如下:
原文出处:duiai -> http://duiai.cc/disable-auto-save-drafts.html
做猪小侠源码的代理,提供一站式服务
如果你不懂得搭建网站或者服务器,小程序,源码之类的怎么办? 第一通过本站学习各种互联网的技术 第二就是联系客服,我帮帮你搭建(当然要收取部分的费用) 第三成为我们的代理,我们提供整套的服务。