解决WORDPRESS运行慢,占内存的方法
发布:smiling 来源: PHP粉丝网 添加日期:2015-03-20 15:56:53 浏览: 评论:0
WORDPRESS运行慢或小vps还背不起了,这些是什么原因呢,下面我们整理了一些关于导致WORDPRESS运行慢,占内存问题的解决办法.
很多人会吐槽wordpress运行慢,占内存,的确如此,wordpress比同类程序要耗资源多一些,我们看看wordpress启动加载了哪些文件就知道原因了.
我们看看wp-settiings.php文件:
- // Attach the default filters.
- require( ABSPATH . WPINC . '/default-filters.php' );
- // Initialize multisite if enabled.
- if ( is_multisite() ) {
- require( ABSPATH . WPINC . '/ms-blogs.php' );
- require( ABSPATH . WPINC . '/ms-settings.php' );
- } elseif ( ! defined( 'MULTISITE' ) ) {
- define( 'MULTISITE', false );
- }
- register_shutdown_function( 'shutdown_action_hook' );
- // Stop most of WordPress from being loaded if we just want the basics.
- if ( SHORTINIT )
- return false;
- // Load the L10n library.
- require_once( ABSPATH . WPINC . '/l10n.php' );
- // Run the installer if WordPress is not installed.
- wp_not_installed();
- // Load most of WordPress.
- require( ABSPATH . WPINC . '/class-wp-walker.php' );
- require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
- require( ABSPATH . WPINC . '/formatting.php' );
- require( ABSPATH . WPINC . '/capabilities.php' );
- require( ABSPATH . WPINC . '/query.php' );
- require( ABSPATH . WPINC . '/date.php' );
- require( ABSPATH . WPINC . '/theme.php' );
- require( ABSPATH . WPINC . '/class-wp-theme.php' );
- require( ABSPATH . WPINC . '/template.php' );
- require( ABSPATH . WPINC . '/user.php' );
- require( ABSPATH . WPINC . '/session.php' );
- require( ABSPATH . WPINC . '/meta.php' );
- require( ABSPATH . WPINC . '/general-template.php' );
- require( ABSPATH . WPINC . '/link-template.php' );
- require( ABSPATH . WPINC . '/author-template.php' );
- require( ABSPATH . WPINC . '/post.php' );
- require( ABSPATH . WPINC . '/post-template.php' );
- require( ABSPATH . WPINC . '/revision.php' );
- require( ABSPATH . WPINC . '/post-formats.php' );
- require( ABSPATH . WPINC . '/post-thumbnail-template.php' );
- require( ABSPATH . WPINC . '/category.php' );
- require( ABSPATH . WPINC . '/category-template.php' );
- require( ABSPATH . WPINC . '/comment.php' );
- require( ABSPATH . WPINC . '/comment-template.php' );
- require( ABSPATH . WPINC . '/rewrite.php' );
- require( ABSPATH . WPINC . '/feed.php' );
- require( ABSPATH . WPINC . '/bookmark.php' );
- require( ABSPATH . WPINC . '/bookmark-template.php' );
- require( ABSPATH . WPINC . '/kses.php' );
- require( ABSPATH . WPINC . '/cron.php' );
- require( ABSPATH . WPINC . '/deprecated.php' );
- require( ABSPATH . WPINC . '/script-loader.php' );
- require( ABSPATH . WPINC . '/taxonomy.php' );
- require( ABSPATH . WPINC . '/update.php' );
- require( ABSPATH . WPINC . '/canonical.php' );
- require( ABSPATH . WPINC . '/shortcodes.php' );
- require( ABSPATH . WPINC . '/class-wp-embed.php' );
- require( ABSPATH . WPINC . '/media.php' );
- require( ABSPATH . WPINC . '/http.php' );
- require( ABSPATH . WPINC . '/class-http.php' );
- require( ABSPATH . WPINC . '/widgets.php' );
- require( ABSPATH . WPINC . '/nav-menu.php' );
- require( ABSPATH . WPINC . '/nav-menu-template.php' );
- require( ABSPATH . WPINC . '/admin-bar.php' );
- //phpfensi.com
- // Load multisite-specific files.
- if ( is_multisite() ) {
- require( ABSPATH . WPINC . '/ms-functions.php' );
- require( ABSPATH . WPINC . '/ms-default-filters.php' );
- require( ABSPATH . WPINC . '/ms-deprecated.php' );
- }
wordpress在启动的时候就默认加载了这么多文件,运行过程中根据插件和主题也加载其他的文件,也许你根本没用到这些文件中的类或者方法.
如何优化wordpress的速度?
用wordpress不用缓存插件的话,那简直无法想象那速度,优化wordpress速度,一定要用缓存.
另外不要过多使用插件,特别是质量低的插件,如果是开发者,多利用wordpress自带的cache函数.
还有一点特殊情况,在国内不能访问谷歌字体和头像服务,要替换成国内的字体镜像,具体方法搜索本站.
Tags: WORDPRESS运行慢 WORDPRESS占内存
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)