最近对wordpress的优化
第一:去掉一些不用的html head内容,让页面更小 在function.php中加入: remove_action( ‘wp_head’, ‘wp_generator’); remove_action( ‘wp_head’, ‘wlwmanifest_link’); remove_action( ‘wp_head’, ‘rsd_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’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 ); remove_action( ‘wp_head’, ‘feed_links’, 2 ); remove_action( ‘wp_head’, ‘feed_links_extra’, 3 ); remove_action( ‘wp_head’, ‘wp_print_head_scripts’, 9 ); remove_action( ‘wp_head’, ‘rel_canonical’ ); remove_action( ‘wp_head’, ‘wp_shortlink_wp_head’, 10, 0 ); 第二:去掉一些定时任务,这些定时任务会频繁访问数据库和网络 在function.php中加入: remove_action( ‘init’, ‘wp_schedule_update_checks’ ); remove_action( ’load-plugins.php’, ‘wp_update_plugins’ ); remove_action( ’load-themes.php’, ‘wp_update_themes’ ); remove_action( ’load-update-core.php’, ‘wp_update_plugins’ ); remove_action( ’load-update-core.php’, ‘wp_update_themes’ ); remove_action( ’load-update.php’, ‘wp_update_plugins’ ); remove_action( ’load-update.php’, ‘wp_update_themes’ ); remove_action( ‘upgrader_process_complete’, ‘wp_update_plugins’ ); remove_action( ‘upgrader_process_complete’, ‘wp_update_themes’ ); remove_action( ‘upgrader_process_complete’, ‘wp_version_check’ ); remove_action( ‘wp_maybe_auto_update’, ‘wp_maybe_auto_update’ ); remove_action( ‘wp_update_plugins’, ‘wp_update_plugins’ ); remove_action( ‘wp_update_themes’, ‘wp_update_themes’ ); remove_action( ‘wp_version_check’, ‘wp_version_check’ ); ...