Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Speed Up Your Wordpress & SEO, Speed up Wordpress & SEO

views
     
TStrallan P
post Apr 27 2019, 08:16 AM, updated 7y ago

New Member
*
Probation
7 posts

Joined: Apr 2019
From: Turkey


Hello guys!

I am from Turkey! While I was seeking solutions for my problem recently I found these forums. While I investigating the forums, I saw that there is a webmaster forums here! Well I am well-known with my SEO works in my country. I wanted to provide some tips for Malaysian brothers here. Because I have seen that most of wordpress websites has problem with speed and some important but basic SEO stuff. Please feel free to ask your questions about on-page and off-page seo. I will gladly answer you about that. I am working on web sector about 20 years.

So let's start.

Speed up your wordpress with codes

Please backup your files and don't yell at me if you do something wrong. (: Important: If your theme supports ioncube, please do all things here step by step. And see the result on each step.

DNS Prefetch
I recommend you to use this for only google or facebook or twitter services. If you use it for a service with slow server connection, it can ruin your speed. I will tell you how to dns prefetch with examples on here. We generally use analytics and facebook services on our websites. Sometimes it can slow down our websites. DNS prefetch can help you about this. You will find some links which starts with following urls below.

Example urls:

CODE
//s-static.ak.facebook.com
//apis.google.com


You will need to go to your header.php and add the following codes to your between <head> </head>:

example code

CODE
<link rel="dns-prefetch" href="https://s-static.ak.facebook.com"/>


You can do it same for google apis and analytics too. Please ensure that your theme doesn't include same codes too. Some coders are adding link rel codes their theme by default.

Remove Queries from CSS and JS files for better caching

Qeuries can create problems while caching and your website sometimes don't be cached fully. However with the following code, you will able to fix this problem. You need to add these codes to your functions.php of your theme.

CODE
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );



No one likes emojis on Wordpress, remove them!

Yeah, if you remove them, you will get rid of another extra js file on your website and this will also speed up your website. You will need to add this to functions.php file of your theme

CODE
/**
* Emojileri kaldir
*/
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );
 
/**
* Tinymce emoji filtre
*/
function disable_emojis_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}



Deregister Wp-Embed
I don't like shiny things which slows down my website! If you like it, let it stay then. However I recommend you to remove this if you care for the speed. Wp-embed is a thing which creates embed posts when you paste to a link to your post editor. You need to add this to functions.php again.


CODE
// WP Embed Scripti Kaldir
function speed_stop_loading_wp_embed() {
if (!is_admin()) {
wp_deregister_script('wp-embed');
}
}
add_action('init', 'speed_stop_loading_wp_embed');


Image Optimization

If image quality is not very important for you, you will need to add this to your functions.php again

CODE
add_filter('jpeg_quality', function($arg){return 70;});


after you add this code you will need to regenerate thumbnails. Go to wordpress plugins and search for regenerate thumbnails. Have the plugin and regenerate all your thumbnails. Image quality will be 70 now. However if images are important for you replace 70 with something between 70-85. I don't recommend you to go below of 70 though.

Plugin for image optimization

If you don't want to do the above and use a plugin After you complete to regenerate thumbnails. Go to plugins page and find EWWW Image optimizer. Download it to your website and enable WebP (force it with js if your server doesn't support it) with it. Also set image quality with the same value above. Then optimize all images from the media section. Your images will be shown as webp.

Defer JS

This can be tricky and ensure that you have test your website with mobile and pc after you defer your js. Sometimes it fails with some themes. When you remove the code, all things will come back. Jquery is important and we are not going to defer it. Otherwise your website will be broken. You will need to add this code below to defer all js except jquery:

CODE
add_filter('clean_url','async_js',11);
function async_js($url) {
      if ( false !== strpos( $url, 'jquery.js' ) || false === strpos( $url, '.js' )) {
          return $url;
      }
      return "$url' defer='defer";       
}


You need to add this to functions.php of your theme again.

if this broken your theme, find out your js files from search console and try defer js files one by one:

CODE
add_filter( 'clean_url', function( $url )
{
    if ( FALSE === strpos( $url, 'example.js' ) )
    { // not our file
        return $url;
    }
    // Must be a ', not "!
    return "$url' defer='defer";
}, 11, 1 );


change "example" with your js file name.

Best Free Cache Plugin

Well the best free cache plugin of Wordpress is Wordpress Fastest Cache at the moment. Actually premium version is doing great jobs. I will tell you how to use the free version. Upload Wordpress Fastest Cache Plugin to your wordpress website and do the following settings.

Please select all settings except Mobile on the settings of the application and click submit button. See the example here: https://prnt.sc/nhfif1


PHP Version

Some servers still providing PHP 5.x as default. It means your website is slower than 2x times than a PHP 7.x website. You will need to go to cpanel and select PHP Version Manager (or PHP Version or you can also request it from service provider too.) Then change it to php 7.2. You can see how to change php version in the video below:

https://www.youtube.com/watch?v=pibZKJVIRfk

PHP 7.x will make your website 3-4 times faster.

Redirect HTTP to HTTPS and force HTTPS

Redirecting http to https is the best for seo and speed. Ensure that your website is working correctly with ssl. You need to see the lock image near of your url on Google chrome or it should be green.


You can use really simple ssl plugin for it. If you don't want to have an extra plugin, Firstly go to Settings -> General on wordpress admin and then change your addresses to https there. Then...


Then can add the following code to .htaccess:

CODE
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</IfModule>



That's all I can remember about speed up wordpress at the moment. However will edit this topic in the future with more details.

If you have any questions about SEO, please feel free to ask me.
TStrallan P
post Apr 27 2019, 08:37 AM

New Member
*
Probation
7 posts

Joined: Apr 2019
From: Turkey


QUOTE
search console


Browser console rather. smile.gif Sorry for mistakes.It seems I can't edit the post.

 

Change to:
| Lo-Fi Version
0.0153sec    0.81    5 queries    GZIP Disabled
Time is now: 20th December 2025 - 04:26 PM