WordPress speed optimization - 6 teaks (without plugins)

Speed up WordPress - 6 tweaks without plugins

You want to speed up your WordPress blog? There are WordPress plugins that try nothing more than to continuously improve the WordPress speed of the content management system. Sometimes these are big complete packages like Swift Performance or WP Rocket, then again extensions for single aspects like Autoptimize or Imagify. But not always a plugin is mandatory to speed up WordPress.

In this article I will show you how you can use very simple tips and tricks for better performance within WordPress. In fact, it’s often just a matter of small settings or lines of code that really anyone can activate or add.

Don’t worry, you don’t need any expertise and you don’t have to be a WordPress professional to implement my tips. A little basic knowledge is already enough to speed up WordPress.

1. Speed up WordPresswith browser caching

There are a total of four header entries controlled by the .htaccess that affect browser caching. These are: Cache-Control and Expires as well as Last-Modified and ETag. The first two define the lifetime from the cache, while the latter have to do with checking in the browser and control if the particular cache is still valid at all.

My recommendation is to control the browser cache with Cache-Control and ETag. The former allows more configuration options and the latter is more reliable in its operation. Basically, Cache-Control determines how long a file remains in the cache, while the ETag changes as soon as updates occur so browsers can detect that the cache is no longer valid and should be renewed.

The ETag is automatically assigned by the server unless you have explicitly disabled this feature. Cache control, on the other hand, is set up in the .htaccess file in the root directory. The following command controls the defaults and can be changed at will. The value specifies how many seconds (in the example 86400, so one day) the cache will persist.

Header Set Cache-Control "max-age=86400"

The command above now stores everything for one day in the browser cache. But this makes only limited sense, because for example images often do not change at all once they are uploaded. So some exceptions should be created. This is done with another code, which you can add below the line above.

<filesMatch ".(jpg|jpeg|png|gif|webp)$">
Header Set Cache-Control "max-age=2592000"
</filesMatch>

With these two lines, images will be cached for a month and everything else for a day. You can of course add more lines and rules to cache CSS and JS files even longer, since they usually never change. Often these can easily keep their validity for a year. Try it out. The browser cache is hugely important if you want to speed up WordPress, as it can drastically reduce requests to the server.

2. Optimize images before upload

Image optimization with Squoosh
Image optimization with Squoosh

There are lots of plugins for WordPress that do automatic image optimization. But they often cost money and have to be installed additionally, which goes on the performance. In addition, images can also be optimized manually, for this you do not need a plugin. So you should rather use an online service.

I can recommend TinyPNG and Sqoosh. Both are excellent online tools that allow you to compress your images before uploading them. This drastically reduces the file size with only minimal loss of quality and significantly improves the loading time.

Especially TinyPNG is for JPG and PNG files an effective way to provide for an extensive WordPress speed optimization. For beginners TinyPNG is therefore super. With Sqoosh more is possible, but then you also have to set a lot of things by hand and should know what you are doing. In everyday life I often use TinyPNG.

3. HTML Minify via Snippet

Minify JavaScript and CSS with minifier.org
Minify JavaScript and CSS with minifier.org

HTML Minify can massively increase WordPress page load speed by decreasing the file size and allowing the browser to transfer and interpret the code faster. Normally this is done with plugins. But you can also do this manually by adding a code to the functions.php of your theme,

By the way, you can also minimize and save your CSS file with an online tool. The same goes for any JS files that come with your theme. Try to minimize everything that is possible. The smaller the files, the more you can speed up WordPress. A few kilobytes often make the difference. Do not underestimate this.

4. Clean out CSS and Javascript

Speaking of CSS and Javascript: It’s equally important to check your files regularly and then tweak them again. Often orphaned and no longer needed entries are not correctly removed from the files. This is always the case when you don’t use certain elements at all, but their design is still defined via CSS.

No tool can do this for you. There are some browser addons that check exactly that, but you always have to check manually what is really needed and what is not. Nevertheless, this step can provide significant reduction, so that CSS and Javascript files shrink accordingly and can be loaded faster.

5. Disable WordPress features

WordPress comes with some features by default that many don’t even need. Unfortunately, these are enabled by default and add various entries, links, files or the like, which then have to be loaded accordingly. You can disable these features to get some more speed. This can be done with the following code.

Disable the integration of emojis, the oEmbeds, the REST API of WordPress and some other features. If you are not familiar or not sure about using the features in your theme, you should leave it alone. Those who have a little expertise will understand what it is all about.

remove_action('wp_head', 'rsd_link');

remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('admin_print_styles', 'print_emoji_styles');

remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);

add_action('init', 'stop_heartbeat', 1);
function stop_heartbeat()
{
  wp_deregister_script('heartbeat');
}

function j0e_dequeue_dashicon()
{
  if (current_user_can('update_core')) {
    return;
  }
  wp_deregister_style('dashicons');
}
add_action('wp_enqueue_scripts', 'j0e_dequeue_dashicon');

function disable_embed()
{
  wp_dequeue_script('wp-embed');
}
add_action('wp_footer', 'disable_embed');

add_filter('rest_enabled', '_return_false');
add_filter('rest_jsonp_enabled', '_return_false');

6. Reduction

You will achieve the biggest advantage in terms of WordPress speedup if you reduce and remove what is no longer needed. Especially beginners tend to install one plugin after another, constantly add new themes and integrate a whole bunch of unnecessary snippets.

So my last tip is clearly about reducing. Remove what you don’t really need. Check every extension for its sense. Does it really bring you or your users something? If not, then do without such gimmicks. Reduction always leads to less code, less plugins, less requests and therefore better loading times. Quite simply.

But because WordPress makes you so comfortable, features and functions are often no longer even questioned, but added as a matter of course. The difference between a WordPress beginner and a WordPress professional is therefore usually that the professional is not blinded by such things. He always asks himself first, if the blog is really improved by a new feature. If not, not having it is often worth more than the feature. Keep that in mind if you want to install another plugin soon.

Accelerating WordPress starts in your own head

The best WordPress Cache Plugins..

It sounds strange, but the last point is one of the most important at all. The true optimization starts in the head. Especially with WordPress, users tend to use simplicity to immediately add a suitable plugin or snippet for everything. Get out of the habit of such behavior immediately. Even if you uninstall plugins, they leave their traces in the database.

Optimization therefore starts in your head by asking yourself what really adds value. Do not underestimate the many little things. An image that is 100 kilobytes in original size can often be reduced by at least 50 percent with appropriate optimization. Even if 100 kilobytes per se is not much, you should remember that you are not just loading an image and a CSS file on your blog. Every kilobyte saved is worth the optimization.

This article is part of my efforts to bring more sense of WordPress speed optimization to my readers. Among other things, there was already the articles free performance plugins and best performance plugins, in which I recommended some plugins. Now here it was about small tips that can do a lot with little effort.

If I could help you, please leave a comment. Maybe you have a tip for the readers that you would like to share with us.

You can find more tips in the article Make WordPress faster.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *