Php WordPress网站等待时间长

Php WordPress网站等待时间长,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我为WordPress构建的自定义主题一直存在问题。现场等待时间约为20秒+ 我尝试了以下方法,但没有成功: 所有插件都已禁用 从主题中删除所有脚本,包括WordPress脚本 切换到其他主机 有人知道会是什么问题吗?我知道Firebug中的等待时间意味着等待服务器响应,但无法解决问题 你应该应用这些规则来获得一些运气: 使用W3 Total缓存插件(这是其细分市场中最好的)或任何其他缓存插件 如果你的主题有一些优化的图片 压缩所有CSS和JavaScript文件 使用惰性加载插件快速加载文

我为WordPress构建的自定义主题一直存在问题。现场等待时间约为20秒+

我尝试了以下方法,但没有成功:

  • 所有插件都已禁用
  • 从主题中删除所有脚本,包括WordPress脚本
  • 切换到其他主机
有人知道会是什么问题吗?我知道Firebug中的等待时间意味着等待服务器响应,但无法解决问题


你应该应用这些规则来获得一些运气:

  • 使用W3 Total缓存插件(这是其细分市场中最好的)或任何其他缓存插件
  • 如果你的主题有一些优化的图片
  • 压缩所有CSS和JavaScript文件
  • 使用惰性加载插件快速加载文本,但在后台加载图像
  • 确保您没有使用任何在大多数情况下会减慢页面加载时间的框架
  • 使用内容交付网络(CDN)
  • 向静态资源添加
    Expires
    标题
  • 尽可能使用静态HTML,因为它加载速度快
  • 确保主题中没有不必要的额外代码或文件
  • 应用上面提到的所有步骤,进一步阅读页面优化技术,以获得良好的长期效果

  • 你应该应用这些规则来获得一些运气:

  • 使用W3 Total缓存插件(这是其细分市场中最好的)或任何其他缓存插件
  • 如果你的主题有一些优化的图片
  • 压缩所有CSS和JavaScript文件
  • 使用延迟加载插件快速加载文本,但不加载背景中的图像
  • 确保您没有使用任何在大多数情况下会减慢页面加载时间的框架
  • 使用内容交付网络(CDN)
  • 向静态资源添加
    Expires
    标题
  • 尽可能使用静态HTML,因为它加载速度快
  • 确保主题中没有不必要的额外代码或文件
  • 应用上面提到的所有步骤,进一步阅读页面优化技术,以获得良好的长期效果

  • 听起来这是一个PHP问题。您是否尝试过绕过PHP,看看这是否就是问题所在?为了测试这一点,我建议安装一个缓存插件,比如,然后在原始服务器上实现,以便在检索该插件生成的缓存HTML时绕过PHP

    Apache的高级代码段:

    # Start Cache Enabler
    <IfModule mod_rewrite.c>
     RewriteEngine On
    
     <IfModule mod_mime.c>
     # webp HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{HTTP:Accept-Encoding} gzip
     RewriteCond %{HTTP:Accept} image/webp
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz [L]
    
     # gzip HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{HTTP:Accept-Encoding} gzip
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz [L]
    
     AddType text/html .gz
     AddEncoding gzip .gz
     </IfModule>
    
     # default HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html [L]
    </IfModule>
    # End Cache Enabler
    

    听起来这是一个PHP问题。您是否尝试过绕过PHP,看看这是否就是问题所在?为了测试这一点,我建议安装一个缓存插件,比如,然后在原始服务器上实现,以便在检索该插件生成的缓存HTML时绕过PHP

    Apache的高级代码段:

    # Start Cache Enabler
    <IfModule mod_rewrite.c>
     RewriteEngine On
    
     <IfModule mod_mime.c>
     # webp HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{HTTP:Accept-Encoding} gzip
     RewriteCond %{HTTP:Accept} image/webp
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz [L]
    
     # gzip HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{HTTP:Accept-Encoding} gzip
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz [L]
    
     AddType text/html .gz
     AddEncoding gzip .gz
     </IfModule>
    
     # default HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html [L]
    </IfModule>
    # End Cache Enabler
    

    哪些文档需要很长时间才能加载?@pedrobito所有网站页面是否使用共享主机或vps?您可能想查看此博客哪些文档需要很长时间才能加载?@pedrobito所有网站页面是否使用共享主机或vps?您可能想查看此博客