wordpress速度优化_加快WordPress网站速度的10种简便方法

wordpress速度优化

WordPress is used by millions as an open-source blogging platform. Many use it to share their thoughts and experiences online. However, WordPress offers a lot more than just blogging tools; it’s actually a robust, customizable content management system, and a lot of businesses use WordPress to develop great business websites that promote companies, products, events, and much more. As with any site, speed is extremely important. Attention spans on the Internet are measured in milliseconds, and even search engines like Google reward site speed with better placement in search results (and penalize slow websites with a lower, less prominent listing in search results). Speed is important, and WordPress websites can be as fast as the any others. Here are ten easy ways to enhance your WordPress website with snappy page loads and increased site speed.

WordPress被数以百万计的人用作开源博客平台。 许多人使用它在网上分享他们的想法和经验。 但是,WordPress提供的不仅仅是博客工具。 它实际上是一个健壮的,可定制的内容管理系统,许多企业使用WordPress开发出色的商业网站,以推广公司,产品,活动等。 与任何站点一样,速度极为重要。 互联网上的注意力跨度以毫秒为单位进行衡量,甚至像Google这样的搜索引擎也会通过提高搜索结果的排名来奖励网站速度(并以较低,不太突出的搜索结果列表惩罚速度较慢的网站)。 速度很重要,WordPress网站可以和其他任何网站一样快。 这是通过快速的页面加载和增加的网站速度来增强WordPress网站的十种简单方法。

切出额外的插件 (Cut Out Extra Plugins)

The first big rule to making WordPress fast is to use as few plugins as possible. Every time you have to send a request, it adds to your load time. If you are a developer, try coding the functionality into your theme by hand. This might be difficult if you don’t know PHP, but if you’re familiar with building WordPress plugins, you can replace plugins with identical functionality programmed directly into your theme. If you’re not a PHP expert, you can still eliminate plugins by looking for a theme that already has the features that you need to begin with. There are literally thousands of themes out there, and you’re bound to find one that has exactly what you are looking for.

使WordPress快速运行的第一个大规则是使用尽可能少的插件。 每次您必须发送请求时,它都会增加您的加载时间。 如果您是开发人员,请尝试将功能手动编码到主题中。 如果您不了解PHP,这可能会很困难,但是如果您熟悉构建WordPress插件 ,则可以将具有直接编程到主题中的相同功能的插件替换。 如果您不是PHP专家,那么仍然可以通过查找已经具有所需功能的主题来消除插件。 实际上有数千个主题,您一定会找到一个完全符合您想要的主题。

使用一个好的托管公司 (Use a Good Hosting Company)

If you are a small business, then shared hosting isn’t a bad option. However, if you are planning on getting a huge amount of traffic, then you will want a dedicated hosting plan with a company that specialized in WordPress hosting such as WP Engine, or MediaTemple. There are others hosting companies dedicated to mainly WordPress out there, but those two are the main ones.

如果您是小型企业,则共享托管不是一个坏选择。 但是,如果您打算获得大量流量,那么您将需要与专门从事WordPress托管的公司(例如WP Engine或MediaTemple)建立专门的托管计划。 还有其他专门致力于WordPress的托管公司,但那两家是主要的。

使用良好的缓存插件 (Use a Good Caching Plugin)

I know that earlier I advised to cut out as many plugins as possible, but you should always use a caching plugin to slice load times. W3 Total Cache is a common plugin that many WordPress administrators use. It’s easy to set up, and you have excellent control over browser and page caching, which will make your load times a fraction of what they used to be.

我知道我早些时候建议尽量减少插件,但是您应该始终使用缓存插件来减少加载时间。 W3 Total Cache是许多WordPress管理员使用的通用插件。 它很容易设置,并且您可以很好地控制浏览器和页面缓存,这将使您的加载时间只是以前的一小部分。

wordpress速度优化_加快WordPress网站速度的10种简便方法

缩小JavaScript和CSS文件 (Minify JavaScript and CSS Files)

This is another aspect handled by the W3 Total Cache plugin. This makes your script and CSS files as small as possible, reducing load times and speeding up your site. Before your minify any files, I’d suggest that you save copies of the expanded versions in case you need them later.

这是W3 Total Cache插件处理的另一方面。 这样可以使脚本和CSS文件尽可能小,从而减少了加载时间并加快了网站速度。 在缩小任何文件之前,建议您保存扩展版本的副本,以备日后需要时使用。

wordpress速度优化_加快WordPress网站速度的10种简便方法

优化图像 (Optimize Your Images)

This is an important one. Don’t upload full-size images that are 1400px by 900px when you are going to be placing them in a spot that is actually much smaller. You don’t need images that large if you aren’t using them at that size. Even if you are using them at that size, I would recommend reducing the size, because it takes longer to load large images. Reduce the size of your images to fit the area that you will be using them precisely. In Photoshop, you can optimize your images before you upload them to your site. Open your images in Photoshop, size them to fit the area that they will be placed, and then go to “File” > “Save For Web.” A dialog box will come up where you can optimize your images. Notice in the top-right corner you can check optimize, make decisions about quality, etc. When you are done, you can see the file size in the bottom left portion of this screen, as shown below.

这是重要的。 当您将其放置在实际上要小得多的位置时,请勿上传1400px x 900px的原尺寸图像。 如果不使用该尺寸的图像,则不需要那么大的图像。 即使您以这种尺寸使用它们,我也建议您减小尺寸,因为加载大图像需要更长的时间。 减小图像尺寸以适合要精确使用图像的区域。 在Photoshop中,可以先优化图像,然后再将其上传到站点。 在Photoshop中打开图像,调整其大小以适合将要放置的区域,然后转到“文件”>“保存为Web”。 将出现一个对话框,您可以在其中优化图像。 请注意,您可以在右上角检查优化,做出质量决定等。完成后,您可以在该屏幕的左下方看到文件大小,如下所示。

wordpress速度优化_加快WordPress网站速度的10种简便方法

On top of that, you can also optimize your images by using an image optimizer called WP-SMush.it. This is a great little plugin to use for your site. It optimizes your images as you upload them, so you don’t have to worry about doing it manually. I would still recommend not using images larger than their intended size on the page. With these two methods combined, your images won’t devour load time.

最重要的是,您还可以使用名为WP-SMush.it的图像优化器来优化图像。 这是一个伟大的小插件,可用于您的网站。 它会在您上传图像时优化您的图像,因此您不必担心手动进行操作。 我仍然建议不要使用大于页面上预期大小的图像。 结合这两种方法,您的图像不会浪费加载时间。

最大限度地利用CSS (Maximize Your CSS Use)

CSS has come a long way in the past few years, and aesthetics that used to require image files can now be achieved fairly easily with carefully-written CSS statements. If you’re still relying on images — even tiny ones — for gradients, shadows, rounded corners, you should consider rebuilding those visual aspects of your site with CSS. It’s not about the size of the images (some gradient slices and shadows are only one pixel wide or long), it’s about the number of requests that visiting browsers have to make for each and every page. Requesting one stylesheet is Make sure that you’ve made the most of recent CSS improvements, and clean your WordPress template of antiquated, image-based aesthetics.

CSS在过去的几年中已经走了很长一段路,现在通过精心编写CSS语句可以相当轻松地实现以前需要图像文件的美观。 如果您仍然依靠图像(甚至是很小的图像)来获取渐变,阴影,圆角,则应考虑使用CSS重建网站的视觉外观。 这与图像的大小无关(某些渐变切片和阴影只有一个像素宽或一个像素长),而与访问浏览器对每个页面的请求数量有关。 请求一个样式表是确保您已充分利用了CSS的最新改进,并清理了过时的,基于图像的美观的WordPress模板。

添加过期标题 (Add an Expires Header)

This is a little advanced, but every little bit helps. An expires header is used to reduce load times for your regular or repeat visitors. It specifies an exact time that has to pass before your visitors’ browsers have to reload files that don’t often change. A good example would be the CSS files on your site. You can determine the amount of time that it will take before your regular visitors need to reload these files, which will greatly reduce load times for them. You implement this technique by going into your .htaccess file and adding code similar to the example below.

这有点先进,但是一点点帮助。 Expires标头用于减少常规访问者或重复访问者的加载时间。 它指定访问者的浏览器必须重新加载不经常更改的文件之前必须经过的确切时间。 一个很好的例子是您网站上CSS文件。 您可以确定常规访问者需要重新加载这些文件之前需要花费的时间,这将大大减少文件的加载时间。 您可以通过进入.htaccess文件并添加类似于以下示例的代码来实现此技术。

ExpiresActive On ExpiresByType text/javascript A2592000 ExpiresByType text/css A2592000 ExpiresByType image/gif A2592000 ExpiresByType image/png A2592000 ExpiresByType image/jpg A2592000

ExpiresActive on ExpiresByType文本/ javascript A2592000 ExpiresByType文本/ css A2592000 ExpiresByType图像/ gif A2592000 ExpiresByType图像/ png A2592000 ExpiresByType图像/ jpg A2592000

The code above looks for the file type. So, for images, it looks for the image and then the file format of the image, such as gif, jpg, or png. The number proceeding the “A” at the end is the length of time that the setting lasts in seconds. The example above is a month, but you can change that at your own discretion.

上面的代码查找文件类型。 因此,对于图像,它将先查找图像,然后查找图像的文件格式,例如gif,jpg或png。 末尾加“ A”的数字是设置持续时间(以秒为单位)。 上面的示例是一个月,但您可以自行决定对此进行更改。

优化您的数据库 (Optimize Your Database)

wordpress速度优化_加快WordPress网站速度的10种简便方法

It is important to optimize your WordPress database. That is where all of the data for your site is stored. It’s a good idea to use a plugin for this one, as it makes the task of database management a snap. I use WP-DB Manager. It helps to get rid of the data that you don’t need, so that your database isn’t trying to process old, unwanted, or irrelevant data. The less work your site has to do, the faster it will load.

优化您的WordPress数据库很重要。 那就是您站点所有数据的存储位置。 为此使用一个插件是个好主意,因为它使数据库管理任务变得轻而易举。 我使用WP-DB Manager 。 它有助于摆脱不需要的数据,从而数据库不会尝试处理旧的,不需要的或不相关的数据。 您的网站要做的工作越少,加载速度就越快。

摆脱旧的帖子修订 (Get Rid of Old Post Revisions)

wordpress速度优化_加快WordPress网站速度的10种简便方法

This is a small thing that can tidy up your site. The WP-DB Manager plugin will handle this, but if you don’t want to use this plugin, you can go into WordPress manually and delete old post revisions permanently. This is a lot of extra work, but it can help reduce the load on your site, which will make your site much faster.

这是一件可以整理您的网站的小事情。 WP-DB Manager插件将处理此问题,但是如果您不想使用此插件,则可以手动进入WordPress并永久删除旧的帖子修订。 这是很多额外的工作,但是它可以帮助减少您网站上的负载,这将使您的网站更快。

减少首页帖子 (Cut Down on Homepage Posts)

It is a good idea to cut down the number of posts shown on your home page (and every other page), because it greatly reduces load time. If you have post thumbnails, your site will have to load each one. Lower the number of posts on your homepage to around five. If someone is actually interested in seeing your older content, you get the benefit of extra pageviews when they decide to browse additional content. Many are tempted to offer huge amounts of information on their homepage, but sensibly offering just your newest or best content on your homepage is definitely a win-win.

减少主页(和其他页面)上显示的帖子数量是一个好主意,因为它可以大大减少加载时间。 如果您有发布缩略图,则您的网站将必须加载每个缩略图。 将您首页上的帖子数量减少到大约五个。 如果某人确实有兴趣查看您的旧内容,那么当他们决定浏览其他内容时,您将获得额外的综合浏览量。 许多人都想在其主页上提供大量信息,但明智地在主页上仅提供最新或最佳内容绝对是双赢的。

结论 (Conclusion)

Cutting down on load times is essential for any site. WordPress is no different, and if you follow the tips listed above, you can reduce load times for your site. This will greatly lower your bounce rate (a measurement of how many visitors arrive at your website and leaves almost immediately). Page speed also plays a part in Google’s new search algorithm, so it is imperative that your site be as fast as possible. This will make your site rank higher in search results, and you will likely get more traffic as a result. You’re also more likely to have repeat visitors, because they know your site loads quickly and isn’t a chore to explore.

减少加载时间对于任何站点都是至关重要的。 WordPress也不例外,如果您按照上面列出的提示进行操作,则可以减少网站的加载时间。 这将大大降低您的跳出率(衡量多少访问者到达您的网站并几乎立即离开)。 页面速度在Google的新搜索算法中也起着一定的作用,因此,您的网站必须尽可能快。 这将使您的网站在搜索结果中的排名更高,从而可能获得更多的流量。 您也很可能会有回头客,因为他们知道您的网站加载速度很快,而且不需花太多时间去探索。

What methods do you use to boost speed with WordPress? Are there any tricks or tips you would like to share? If so, post them in the comments section below.

您使用什么方法来提高WordPress的速度? 您想分享任何技巧或提示吗? 如果是这样,请将其发布在下面的评论部分。

翻译自: https://www.sitepoint.com/tips-for-speeding-up-your-wordpress-site/

wordpress速度优化