禁止wp更新 : open file "wordpress\wp-includes\update.php". 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;")); // 关闭主题提示 remove_action('admin_init', '_maybe_update_core'); // 禁止 WordPress 检查更新 remove_action('admin_init', '_maybe_update_plugins'); // 禁止 WordPress 更新插件 remove_action('admin_init', '_maybe_update_themes'); // 禁止 WordPress 更新主题 将下面的代码添加到当前主题的 functions.php 文件,即可禁用所有页面的评论功能: function disable_page_comments( $posts ) { if ( is_page()) { $posts[0]->comment_status = 'disabled'; $posts[0]->ping_status = 'disabled'; } return $posts; } add_filter( 'the_posts', 'disable_page_comments' ); 禁用及删除版本修订历史 版本修订历史在每一次编辑文章过后,都会自动保留一份,这样的话很容易造成数据的重复储存,占用不必要的资源。 打开wp-config.php,在末尾添加 define('WP_POST_REVISIONS', false); 禁用自动保存 在wp-admin目录,打开post.php、page.php、post-new.php和page-new.php,查找 wp_enqueue_script('autosave'); 替换为 //wp_enqueue_script('autosave'); 禁用自动草稿 在wp-admin/includes目录,打开post.php,查找 if ( $create_in_db ) { $post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) ); $post = get_post( $post_id ); if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) set_post_format( $post, get_option( 'default_post_format' ) ); } 替换为 if ( $create_in_db ) { global $current_user; $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 ); } if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) set_post_format( $post, get_option( 'default_post_format' ) ); } http://www.pythoner.com/27.html