WordPress system optimization dramatically improved the display performance of the site from 73 to 96 in PageSpeed ​​Insights score!

⌛Time it takes to read this article: 8 minutes

update Last updated: July 1, 2026 at 11:25 AM

This site, senris.com, is built on WordPress, one of the most popular CMSs, but as a result of installing a large number of plugins, the system became bloated, resulting in a sudden drop in performance and extremely slow display speed. Decrease in display speed also has a negative impact on SEO.

Up until now, in order to improve the performance of the WordPress system, we had been using "Google AdSense lazy loading" and the plugin Jetpack Boost, which had been supported for a long time, but these alone did not have a significant effect.

Therefore, in order to further improve performance, from April to June 2026,Pragun review(Uninstallation or alternative functionality)Introduction of cache plugin “WP Fastest Cache”DB optimizationSuppressing scriptsReducing the weight of access analysis CGI We implemented a series of system optimizations to improve performance.

In the process, we uninstalled the dashboard plugin ``hpb Dashboard'' included with the ``Just System Homepage Builder'' WordPress theme, which has been reported to have a cross-site scripting (XSS) vulnerability, and changed the design of the share button.

As a result, web pages display better and provide performance indicators. Google PageSpeed Insights The score value of 73 From 96 performance has improved dramatically.

PageSpeed Insights (PSI) is a free tool from Google that measures web page loading speed and user experience, and suggests improvements. Compatible with both mobile and desktop devices, it generates detailed reports by simply entering a URL.
In that report, the "scoring standards" that indicate the evaluation criteria for the site are as follows.

📈 Scoring criteria

Scores range from 0 to 100 for categories such as performance, accessibility, best practices, and SEO.

  • 🧰 90 〜 100: Good
  • 🧰 50 〜 89: Needs improvement
  • 🧰 0 〜 49:Poor

Below, we will provide a detailed explanation of the system optimization implementation in chronological order.

Review of plugins

In order to eliminate waste from the system, which is one of the causes of server load, I temporarily installed WordPress plugins that I don't use often and only use them when needed, and basically uninstalled all plugins that I don't use often.
This makes the system lighter and WordPress startup faster.

In addition, plugins that have been reported to have serious vulnerabilities by auditing agencies, plugins that have not been updated for a long time, and plugins that require extremely heavy processing are also subject to uninstallation.
For uninstalled plugins, we will investigate alternative methods such as plugins, widgets, and shortcodes, and if possible, develop our own.

The target plugins are as follows.

Archives Calendar Widget ⇒ Replaced with self-made "Custom Calendar Widget"

"Archives Calendar Widget" is a plugin that allows you to display calendars including Cascam posts in various designs.
However, as reported by WordPress security audit agencies (Wordfence and WPScan), the final version (1.0.15) of this plugin has Stored Cross-Site Scripting (XSS / Stored Cross-Site Scripting) vulnerability has been discovered (CVE-2024-33950).
The developer abandoned development without releasing a patch, so it was permanently banned from the official directory.
Therefore, I decided that it was dangerous to continue using this plug-in, so after uninstalling it, I replaced it with the self-made "Custom Calendar Widget" that I previously reported in the article below.

The custom calendar widget now supports the WordPress core cache (Object Cache), so page display overhead has been significantly improved compared to the Archives Calendar widget.

Auto Limit Posts Reloaded ⇒ Replace with your own creation

"Auto Limit Posts Reloaded" is a plugin that automatically extracts posted articles in WordPress and inserts a "Read More" button on archive pages, etc.
But nowCross-site request forgery (CSRF)Due to reported vulnerabilities, it is recommended to avoid using it from a security perspective.

Therefore, as shown in the article below, I uninstalled the plugin and replaced it with the homepage builder theme program (functions.php).

BackWPup ⇒ Uninstall

"BackWPup" is a free plugin that allows you to back up your entire WordPress site.
However, this plugin puts a heavy load on the server, so I uninstalled it. For backup, just use the plugin "UpdraftPlus".

Broken Link Checker ⇒ Uninstall

"Broken Link Checker" is a plugin that checks for broken links and images, but I uninstalled it because the server load was extremely heavy. Check for broken links (404 errors) on your site.Google Search ConsoleYou can deal with this.

Cool Tag Cloud ⇒ Homemade alternative

"Cool Tag Cloud" is a plugin that implements a colorful and responsive tag cloud.
However, this plugin hasStored XSS (stored cross-site scripting)A serious vulnerability (CVE-2025-13614) has been reported. In December 2025, from the official WordPress directorystop temporarilyHowever, no corrected version has been released at this time.

Therefore, I uninstalled this plugin and used my own tag cloud instead. The configuration of the self-made tag cloud does not depend on plugins,Standard tag cloud + “Additional CSS”I asked Gemini to create it with the following configuration as shown in the article below.

Custom Post Type Cleanup ⇒ Uninstall

"Custom Post Type Cleanup" is a plugin that allows you to delete articles and metadata of unused custom post types.
However, since I do not use this plugin all the time and there is no guarantee that it will work in the current environment, I have uninstalled it.

hpb Dashboard ⇒ Uninstall

"hpb Dashboard" is a WordPress theme dashboard plugin that comes with Just System's "Homepage Builder".
However, this plugin hasCross-site scripting (XSS)vulnerability (JVNDB-2022-011771) has been reported, so uninstall it.
Regarding the vulnerability, it seems that it is probably caused by the form function (which has been patched), but it is not certain. I have reported this issue to the WordPress support forum in the past (WordPress.org Support Forum)。

On the production site, in the dashboard plugin (main program: hpbtools.php),Google Analytics (submodule: google_analytics.php) andSocial button settings (submodule: social_buttons.php), it can be disabled and uninstalled by replacing those functions with other plugins or self-made programs.

The dashboard plug-in has already been successfully uninstalled on the test site, and it has been verified that normal operation is possible without hpb Dashboard. Uninstalling the dashboard plugin eliminates unnecessary processing and improves processing speed.

At this site, we have been working on the theme program for many years and customizing it thoroughly. This is a fairly old theme (classic theme), so if you don't modify it, it will not work properly with the latest WordPress. Therefore, it is difficult to change the theme now.

Here, we will explain in detail the support for "Google Analytics 4" and "Social Buttons" below.

Compatible with Google Analytics 4

Add a script to the theme's header.php as follows (line 15, line 69 to 92) to enable output of the global site tag "Global site tag (gtag.js)" of "Google Analytics (GA4)" even if the dashboard plugin "hpb Dashboard" is not installed or disabled.

As a result, the Google Analytics 4 global site tag will be output on pages other than the administrator page even without the dashboard plugin.

<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="main">
 *
 * @package _hpb
 */

// 各ファイルの更新日時(タイムスタンプ)を自動取得してキャッシュバスターにする
$style_ver = file_exists(get_template_directory() . '/style.css') ? filemtime(get_template_directory() . '/style.css') : '1.0';
$hpb_ver   = file_exists(get_template_directory() . '/style-hpb.css') ? filemtime(get_template_directory() . '/style-hpb.css') : '1.0';

// GA4の測定ID設定
$hpb_tracking_id = 'G-**********';
?>

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="facebook-domain-verification" content="******************************" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>?ver=<?php echo $style_ver; ?>" type="text/css" />
<link rel="stylesheet" id="style-hpb18-css" href="<?php echo get_template_directory_uri(); ?>/style-hpb.css?ver=<?php echo $hpb_ver; ?>" type="text/css" media="all" />

<!--[if lte IE 7]>
<link rel='stylesheet' href="<?php echo get_template_directory_uri(); ?>/style-ie7.css" type='text/css' />
<![endif]-->

<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->

<!-- Favicon定義 16/32/48 -->
<link rel="shortcut icon" href="/favicon.ico">

<!--日本語(地域:日本)-->
<link href="https://senris.com/" rel="alternate" hreflang="ja-jp" />

<!--英語-->
<link href="https://senris.com/?lang=en" rel="alternate" hreflang="en" />

<!--Google Adsense-->
<script>
//<![CDATA[
//lazy load ads
var lazyloadads = false;
window.addEventListener("scroll", function() {
	if ((document.documentElement.scrollTop != 0 && lazyloadads === false) || (document.body.scrollTop != 0 && lazyloadads === false)) {
		(function() {
			var ad = document.createElement('script');
			ad.type = 'text/javascript';
			ad.async = true;
			ad.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456';
			var sc = document.getElementsByTagName('script')[0];
			sc.parentNode.insertBefore(ad, sc);
		})();
		lazyloadads = true;
	}
}, true)
//]]>
</script>

<?php
// プラグインの判定関数を安全に読み込む
if ( ! is_admin() ) {
    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    
    // 'hpb Dashboard' が【インストールされていない】または【無効化されている】場合だけ実行
    if ( ! is_plugin_active( 'hpbtool/hpbtools.php' ) ) {
        
        // 変数 $hpb_tracking_id が定義されていない場合の保険(必要に応じて実際のIDへ書き換え)
        $hpb_tracking_id = isset($hpb_tracking_id) ? $hpb_tracking_id : 'G-XXXXXXXXXX';
        ?>
        <!-- Global site tag (gtag.js) - Google Analytics -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_attr($hpb_tracking_id); ?>"></script>
        <script>
          window.dataLayer = window.dataLayer || [];
          function gtag(){dataLayer.push(arguments);}
          gtag('js', new Date());

          gtag('config', '<?php echo esc_js($hpb_tracking_id); ?>');
        </script>
        <?php
    }
}
?>
<?php wp_head(); ?>
</head>


In the above code, the marked parts represent additions (additional functions) to the original program shown below.
I will explain later about "lazy load ads" written in the comments, but please refer to this article for an explanation about "cash buster" in style.css 👉 Theme CSS is compatible with Cash Buster

<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="main">
 *
 * @package _hpb
 */
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="stylesheet" href="<?php bloginfo ( 'stylesheet_url' ); ?>" type="text/css" />
<link rel="stylesheet" id="style-hpb18-css" href="<?php echo get_template_directory_uri(); ?>/style-hpb.css" type="text/css" media="all" />
<!--[if lte IE 7]>
<link rel='stylesheet' href="<?php echo get_template_directory_uri(); ?>/style-ie7.css" type='text/css' />
<![endif]-->
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
** 以下略

Support for social buttons

The social button setting function (submodule: social_buttons.php) built into the dashboard plugin allows you to use the method described in the article below to rewrite the script originally intended for the "Like" button to a "Share" button that supports displaying the number of shares via the Graph API (old design).

However, in order to display the number of shares, it is necessary to obtain an ``app ID'' and select a ``use case,'' and the current specifications require business authentication from Meta to use the app.
Facebook's system (Graph API) will begin to function properly only after passing the business verification review and switching the app to "live mode (public)."

Meta's AI ``Business Support Home'' is the point of contact for business certification reviews, but the procedures are complicated and mysterious, and when I inquired about the reason why the review was not progressing at all, I was passed around between the departments in charge of AI because they were not in charge and could not respond, and I was fed up with their inaction. I think this is a problem because Meta is a huge, bureaucratic organization with a vertically divided chain of command. Also, meta servers have many problems and often go down.

In the process of applying for business certification, there are many cases where the process stops midway within the system and the status remains "under review" for months without any notification from Meta, and this seems to be a worldwide problem.

In fact, at Meta's request, we were also made to create a page for domain authentication and identity verification, and in addition to credit card registration, we also submitted an additional document, My Number Card, but more than two months have passed and we have not heard from him at all. Even if you contact Meta's AI, you will only get a template answer that says, "We are busy with the review process. The review process will take some time, so please wait."

There is talk that signing up for Meta's ``paid subscription for businesses'' and receiving support from humans instead of AI could lead to a solution, but you may end up just throwing money away.

In addition, even if it passes the examination, there is no guarantee that the number of shares will be displayed correctly in the future, as Meta has already moved towards abolishing the acquisition and display of share numbers.

Therefore, if you are not concerned about displaying the number of shares, you can use the share button display plugin below instead of using the theme's social button function.AddToAny Share Buttons” I declare that the alternative method is free from Meta Inc.'s curse and is the most refreshing solution (new design).

By installing AddToAny Share Buttons, you will no longer need vulnerable dashboard plugins and can safely uninstall them.

In addition, if the option button "Automatically configure OGP" is selected in the social button settings of the dashboard plugin, OGP information will be output from social_buttons.php.Rank Math SEO” plugin.

Regarding the ``breadcrumb list output function'' (breadcrumb.php) supported by the homepage builder's WordPress theme, we left only the display to the theme's program, and set the output of structured data (JSON-LD + schema.org) to be output from ``Rank Math SEO'', which will be described later.
With Rank Math SEO, you can also set the "Facebook App ID" and "Facebook Secret ID" in the social meta settings.

Then, experimentally AddToAny Share Buttons enabled, hpb Dashboard disabledAs a result of checking the operation, we confirmed that there were no problems at all.
As the review of Meta's business certification has reached a complete stalemate, we have given up on Meta, deleted the ``business information page,'' and applied for the discontinuation of the review. and" hpb Dashboard” is completely uninstalledI did.

Jetpack Boost ⇒ Replace with WP Fastest Cache

"Jetpack Boost" is a plugin provided by Automattic that is a tool for improving website display speed.
The "Connect JS" function in Jetpack Boost does not function as "HTTP error 403" when the server side WAF (firewall) setting is turned on in the core server (V1), that is, when "WordPress login restriction (access restriction from overseas IP)" is turned on.
Also, if you only want to use Jetpack Boost's two functions, ``concatenate JS'' and ``concatenate CSS,'' you can use the caching plugin ``WP Fastest Cache,'' so I uninstalled Jetpack Boost and instead installed WP Fastest Cache, which is highly rated by users as a caching plugin.

Media Cleaner ⇒ Uninstall

"Media Cleaner" is a plugin that allows you to organize your WordPress media library and efficiently delete unused images and unnecessary files.
However, since I don't use this plugin all the time, I uninstalled it.

mb.miniAudioPlayer ⇒ Replaced with Audio block & CSS

"mb.miniAudioPlayer” is a lightweight HTML5/jQuery-based plugin for embedding audio files such as MP3 and OGG on your website.
However, this plugin has not been updated for over four years, with the last version being version 1.9.7 in November 2021. I uninstalled it because even if new dangerous vulnerabilities are discovered in the future, there is a very high possibility that a patch will not be provided.
Instead, the design was adjusted under the supervision of Gemini, and the following CSS was added and the standard "Audio block" was used.

/* 黒背景のサイトに最適化したミニ音声プレイヤー(左寄せ・極細ネオン版) */
.wp-block-audio audio {
    display: block;
    max-width: 280px;  
    height: 28px; 
    margin: 21px auto 21px 0;
    border-radius: 30px;
    
    /* 
       1つ目の影:プレイヤーのキワを白くクッキリ光らせる(1pxの輪郭線のような効果)
       2つ目の影:外側に白くボヤッと広がる柔らかな光(グロウ効果)
    */
    box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.6), 
                0 0 12px 2px rgba(255, 255, 255, 0.2);
    
    transition: all 0.3s ease;
}

/* マウスを乗せたときに、さらに光を強くする演出 */
.wp-block-audio audio:hover {
    transform: translateY(-2px);
    /* マウスホバーで光の範囲と強さをアップ */
    box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.8), 
                0 0 16px 4px rgba(255, 255, 255, 0.3);
}

Plugins Garbage Collector (Database Cleanup) Old! ⇒ Uninstall

"Plugins Garbage Collector" is a plugin that can scan your WordPress database and delete old data (tables) previously used by plugins.
However, since I don't use this plugin all the time, I uninstalled it. Note that WP-Optimize also has a function to delete unnecessary tables, so this plugin is basically unnecessary.

Really Simple CAPTCHA ⇒ Uninstall

I uninstalled the plug-in "Really Simple CAPTCHA" that was installed with Contact Form 7 because its security level is low and its existence is only a disadvantage.
In Contact Form 7's "Integration settings with external APIs", Akismet and reCAPTCHA have already been selected as SPAM measures, so Really Simple CAPTCHA is not necessary at all.

Regenerate Thumbnails ⇒ Uninstall

"Regenerate Thumbnails" is a plugin that allows you to regenerate all thumbnail sizes from one or more images uploaded to your media library.
However, since I don't use this plugin all the time, I uninstall it.

ResponsiveVoice Text To Speech ⇒ Replace with your own creation

"ResponsiveVoice Text To Speech" is a WordPress plugin that automatically reads out the specified text.
However, when you install this plugin, when reading articles,Waiting for 2.1 seconds to load each timeoccurs,PageSpeed InsightsIt was causing a significant drop in my score and Google's SEO rating, so I uninstalled it to reduce the server load.

In addition to uninstalling ResponsiveVoice, you also need to delete the ResponsiveVoice script tag from the theme's header.php (or footer.php).

Therefore, as an alternative to ResponsiveVoice, we added a snippet to functions.php using JavaScript implementation so that the text-to-speech function of the browser can be called with the shortcode "say" using the following format.

[say]Interrupt me, if you need me.[/say]

Execution result: Interrupt me, if you need me.

By the way, regarding the implementation of the short code "say", we asked Gemini to create a spec that allows various browsers to call the voice reading function using a female synthesized voice.
For more details, please see the article below...

Exchange SlimStat Analytics ⇒ WP Statistics

"Slimstat Analytics" is a plugin that allows you to analyze access to WordPress sites.
However, in WordPress 6.9.4 and later, SlimStat Analytics version 5.4.1 encountered trouble due to a serious bug and remained unstable, so we uninstalled the SlimStat Analytics plugin and installed the following plugin WP Statistics.

WP Maintenance Mode & Coming Soon ⇒ Uninstall

The plugin name has now been changed to “LightStart – Maintenance Mode, Coming Soon and Landing Page Builder”.
This is a plugin that you can use if you want to keep your site in maintenance mode (private) until the site is completed, but since you won't be using it first, I uninstalled it.

XO Event Calendar ⇒ Uninstall

“XO Event Calendar” is a simple event calendar plugin for WordPress.
However, the XO Event Calendar will be updated in January 2026.Permanently suspended due to "author's request"(closed). This means that it was difficult to fix critical security issues, or the developer has completely abandoned support, and there is no hope that it will be safe in the future.

Currently, a vulnerability due to "Stored Cross-Site Scripting (Stored
CVE record: CVE-2026-0556

Yoast SEO ⇒ Exchange to Rank Math SEO

"Yoast SEO" is a globally popular SEO plugin for WordPress that is used on over 10 million sites.
However, in Yoast SEO version 27.3, when I clicked "Post" on the Yoast SEO settings screen, I got an error saying "t.split is not a function" and was unable to set it up, probably due to interference with other plugins, so I switched to the plugin "Rank Math SEO" below. Rank Math SEO allows you to inherit Yoast SEO settings as is.
The advantages of switching to Rank Math SEO are that compared to Yoast SEO, which is unstable and heavy, the free version has far more features, is easier to set up, and is more agile.

By installing the Rank Math SEO plugin, OGP information will be automatically output.
In Rank Math SEO's module settings, you may want to enable the following features: Schema (Structured Data), Breadcrumbs, Sitemap, Instant Index, and Content AI.

As a result of uninstalling Yoast SEO, the display problem with Firelight Lightbox was resolved, and the temporary plug-in "Load Combined Core Block Assets" was no longer needed!

Note that even if Yoast SEO is uninstalled, garbage remains in the DB tables, so if you want to clean it up, you can clean it up by using the plugin "WP-Optimize" to clean it up (delete unnecessary tables).

Introduction of cache plugin “WP Fastest Cache”

I didn't see much performance improvement with Jetpack Boost, so I installed WP Fastest Cache, a cache plugin recommended by Gemini that has high user ratings, is the most stable, and can speed up your site with simple settings.

Below is the configuration screen for WP Fastest Cache. This plugin is easy to use as it has a very simple UX. After installing it, the display speed of the site became noticeably faster.


The example below shows how to make the WP Statistics shortcode defined in the text widget compatible with Ajax. As a result of trying it, it seems that Ajax does not work unless you activate the paid plan add-on "Rest API Add-on".

<div class="wp-statistics-widget">訪問者数: [wpstatistics stat=visitors time=today ajax=1] / [wpstatistics stat=visitors time=yesterday ajax=1] ([wpstatistics stat=usersonline ajax=1] オンライン)
全ページビュー数: [wpstatistics stat=visits time=today ajax=1] / [wpstatistics stat=visits time=yesterday ajax=1]
現ページビュー数: [wpstatistics stat=pagevisits time=today ajax=1] / [wpstatistics stat=pagevisits time=yesterday ajax=1]</div>


Therefore, it is physically impossible to set ``not to cache only part of the page (widgets)'' in the free version of WP Fastest Cache, so as a compromise when using the free version, we have set it to automatically clear the cache once every hour, as shown in the ``Timeout Rule'' setting below.

Adsense lazy loading

As there was a noticeable drop in performance due to "Google AdSense", we corrected it by modifying the AdSense code pasted in header.php as follows.

<!--Google Adsense-->
<script>
//<![CDATA[
//lazy load ads
var lazyloadads = false;
window.addEventListener("scroll", function() {
	if ((document.documentElement.scrollTop != 0 && lazyloadads === false) || (document.body.scrollTop != 0 && lazyloadads === false)) {
		(function() {
			var ad = document.createElement('script');
			ad.type = 'text/javascript';
			ad.async = true;
			ad.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456';
			var sc = document.getElementsByTagName('script')[0];
			sc.parentNode.insertBefore(ad, sc);
		})();
		lazyloadads = true;
	}
}, true)
//]]>
</script>
<!--
オリジナルコード「<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456"
     crossorigin="anonymous"></script>」
-->


AdSense lazy loading is an effective way to dramatically improve your site's initial loading speed (PageSpeed ​​Insights score, etc.). Configure your ad data to load only when the user scrolls to the ad (or clicks the button), rather than when the page loads.

DB optimization

For DB optimization, use the plugin "WP-Optimize". WP-Optimize is a standard plugin that cleans your WordPress site's database and speeds up page display speed. It can also automatically reduce the weight of your site by deleting unnecessary data that is automatically accumulated and compressing images.

Migrate from MyISAM to InnoDB with WP-Optimize

InnoDB is the default for systems built today due to its superior safety and concurrency. However, if you are using MyISAM on older systems, we recommend migrating to InnoDB for data integrity and improved performance.
InnoDB is the current standard for MySQL/MariaDB, and many WordPress plugins are also designed with InnoDB in mind.

As shown below, select the WP-Optimize menu "Database ≫ Table" and convert the MyISAM style table created in the old system to InnoDB.
In addition, just in case, please be sure to back up your database from another tab of WP-Optimize (UpdraftPlus, etc.) or the server management screen before performing the conversion process.


Once the conversion is complete, delete the cache from the "Cache" tab in WP-Optimize to ensure that the latest database status is reflected.

Delete unnecessary tables with WP-Optimize

Even if you uninstall "Yoast SEO", garbage remains in the DB tables as shown below, resulting in poor response, so use WP-Optimize to delete unnecessary tables.
Please make a backup just in case. If UpdraftPlus is installed, UpdraftPlus automatically backs up the table when you press the delete button.


As a final step in DB optimization, run DB optimization from the "Optimize" tab in WP-Optimize. The reasons for performing optimization are as follows.

Why you should do it

  • Speed ​​up your site:By eliminating unnecessary free space (overhead), database read and write speeds are improved.
  • Reduce server load:By making the database lighter, you can save on server-side resources (memory, etc.).
  • Lighter management screen:Saving articles and operating plug-ins will now work smoothly.

Reducing the weight of access analysis CGI

As shown in the article below, the Perl access analysis CGI "access.cgi", which had a large overhead, was remade into an ultra-lightweight access analysis CGI under the supervision of Gemini.

Regarding access analysis, it is usually sufficient to use the raw logs of the core server, "AWStats", the WordPress plugin "WP Statistics", and "Google Analytics 4", and in order to reduce the server load, the home-made access analysis CGI "access.cgi" is not enabled.

The process of calling an external CGI from a web page imposes a large overhead on the server, so it is best to avoid using it if possible, but since access.cgi can check for unwanted BOTs in real time, we decided to enable it only when we want to monitor the access status of a site, such as investigating unauthorized access.

Suppressing scripts

We will analyze reports from the free tool "PageSpeed ​​Insights" provided by Google and aim to improve performance by taking measures to suppress scripts.

PageSpeed ​​Insights (before optimization)

The results of "PageSpeed ​​Insights" before optimization are as follows.
mobile score value 60 (unqualified), the desktop score value is 73 (passed)is shown.


In fact, when we asked Gemini to analyze this result, they provided us with appropriate ways to improve it, as shown in the chat below.
Sorry, this quote is a little long, but the part marked in yellow is what I said. Please for your reference 😓

…Is there a problem with js/soundmanager2-nodebug-jsmin.js?ver=7.0?

This JavaScript file is included in the warning "Avoid long-running tasks on the main thread" in the image. In conclusion,Although this is not a fatal error at this time, there is room for improvement as it causes a "catch (delay)" in page loading and operations.

The specific situation, reasons, and solutions are as follows.

1. Why is it listed as a problem (warning)?

  • Occupying the main thread:
    It takes 105 ms (milliseconds) to process this JavaScript file (SoundManager2).
  • Impact on user experience:
    While the browser is performing this process, the screen will become temporarily frozen (unresponsive) even if the user taps or scrolls the screen. This is Google's key metricINP(responsiveness)lead to deterioration.

2. Plugin causing the problem

WordPress plugin from the URL path (/wp-content/plugins/compact-wp-audio-player/)"Compact WP Audio Player"You can see that this is the file being read.

3. Recommended improvement measures

Please try the following methods to see if you can eliminate or reduce the delay caused by this file.

  • Plugin loading optimization (recommended):
    "Flying Scripts"or"WP RocketUse a Delay JavaScript feature such as `` to delay loading this audio player's script until the user scrolls or interacts with the page.
  • Disable on unnecessary pages:
    If you are using this audio player only on "specific pages" such as the top page, please click "Asset CleanUpUse a plugin such as `` to prevent this file from being loaded on pages that do not use the player.
  • Consider alternative plugins:
    If the above settings are difficult or do not improve, please consider switching to another lightweight audio player plugin or switching to the standard WordPress audio block.

This audio player isDo you need to be able to play immediately on every page on your site (such as the home page)? Or is there no problem if it only works on a specific detail page? If you let us know the intended use, we can suggest more specific measures.

Compact WP Audio Player is used only on the top page.

If it is only used on the top page,Completely stop loading this plugin on all other pages (post pages, static pages, etc.)is the most effective remedy.

As a result, the "105 ms" delay will be reduced to zero on all pages other than the top page, resulting in lighter pages and improved scores.

WordPress plugin for configuration"Asset CleanUp"It is easiest and safest to use .

How to do it without using plugins?

To optimize without using new plugins, WordPressin the theme folder Functions.php How to write code directly into a file calledThere is. [1]

If you use this method, there will be no unnecessary load on the server or site (plug-in maintenance costs, etc.)."Do not load audio player script for pages other than the top page"You can issue the command. [1, 2]

Specific correspondence code

Paste the code below exactly as it is at the bottom of your theme's functions.php. [1]

php

/**
* トップページ以外でCompact WP Audio Playerの読み込みを停止して高速化
*/
function dequeue_compact_wp_audio_player_scripts() {
// もし「トップページではない」場合
if ( ! is_front_page() && ! is_home() ) {
// 音声プレイヤーのJavaScriptファイルを停止
wp_dequeue_script('sc-audio-player-script');
wp_deregister_script('sc-audio-player-script');

// (予備)デザインが崩れないよう、念のため関連するスタイル(CSS)も停止
wp_dequeue_style('scap-player-style');
wp_deregister_style('scap-player-style');
}
}
// 読み込み順の競合を防ぐため、100番(かなり後方)の優先度で実行
add_action('wp_enqueue_scripts', 'dequeue_compact_wp_audio_player_scripts', 100);



コードは注意してご使用ください。


💡 Points to note

Depending on the plug-in type and version, the program identification name (sc-audio-player-script part above) may be different.

If the above code does not stop loading on other pages even after pasting it (it continues to display a warning in PageSpeed ​​Insights), the identification name may be different. [1, 2]

thank you. Improved!

I'm really glad to hear that things have been fixed successfully! You successfully completed the somewhat stressful task of directly editing functions.php.

When I checked the new image you sent, I can confirm that soundmanager2-nodebug-jsmin.js (105 ms) has successfully disappeared (loading has stopped) from the previous item "Task execution for a long time on the main thread". That's great responsiveness!

🧰 Advice for next steps

The currently open item isAvoiding excessive network payloads(Total size: 3,475 KiB)" is a warning about the data capacity of the entire page.

If you want to further increase the top page display speed (PageSpeed ​​Insights score), it is effective to take measures against the following files listed under this item.

  • Google reCAPTCHA(Security of inquiry forms, etc.)
  • …recaptcha__en.js (376.0 KiB) is loaded multiple times, taking up most of the space.
  • Like the audio player,"Other than the contact page reCAPTCHA "Do not load" By adding this code to functions.php, you can instantly reduce the weight of the top page.
  • Further compression of image files
  • A GIF image called …/Flag_EN3.gif (176.7 KiB) and …/header-main.webp (97.5 KiB) are displayed.
  • In particular, GIF images tend to have a large amount of data, so if it is a still image, there is room to further reduce the size by converting it to WebP format or using an image compression tool (such as TinyPNG).

This time, the delay in the audio player, which was the biggest bottleneck, has been successfully resolved, so I'm relieved!

If the above "reCAPTCHA"Code to stop on other than specific pages" If you would like to know more about other improvements, please feel free to contact us at any time. Thank you for your hard work!

Performance (mobile) has also increased from 60 to 66.

Congratulations on improving your score to 66!

It is difficult to judge scores in a mobile (cell phone) environment, so it is a great result that the numbers improved visibly with just one measure. This is proof that it has been properly optimized.

By analyzing the current numbers displayed on the screen, you can clearly see the path to the next step.

Analysis of current indicators (what is good and what is a problem)

  • 🧰 great point
  • Cumulative Layout Shift (CLS) : 0
  • The visual stability of the page is "perfect". There is no problem with the screen shaking while loading.
  • Total Blocking Time (TBT) : 200millisecond
  • This measure reduces JavaScript blocking time and improves responsiveness to user operations.
  • 🧰 the biggest bottleneck
  • Speed Index : 10.8Second(The time it takes for the page content to visibly fill up)
  • Largest Contentful Paint (LCP) : 5.0Second(Time until the largest main content is displayed)

Next, set the score to “Green (90Strategies to get closer to the above)

The cause of "Speed ​​Index" and "LCP" which are currently colored red (🔺) was shown in the image earlier.“Excessive network payload (overall data capacity of page3.4MBand a big thing)”are directly connected.

Because it takes time to download 3.4MB over the mobile network, there is a delay in displaying the entire screen (Speed ​​Index) and displaying the main image (LCP).

If you want to raise your score further from here to ``late 70s to 80s,'' we recommend taking measures in the following order of priority.

  1. reCAPTCHAOptimized loading (stopping on pages other than the contact page)
  • As I mentioned earlier, the heavy security script that is 376KB x multiple loads on the top page will be excluded using functions.php, just like the audio player. This could potentially reduce the size by nearly 1MB at once.
  1. Main image (header-main.webpetc.) Further weight reduction
  • The file size of large images in the first view (top of the screen) will be further compressed to the limit without reducing image quality.
  1. unnecessarygifDelete or replace images
  • If the large Flag_EN3.gif (176.7 KiB) is unnecessary, delete it or replace it with a still image (WebP).

This time we took a dramatic step forward!

With this momentum, I talked about it earlier."Other than the contact page Google reCAPTCHA Code to stop loading (Functions.php(For additional notes)Shall we create it now?

Is the contact form currently separated into its own page (e.g. Inquiry, Contact, etc.)? Or is there a form on the top page as well?

The contact form is "Contact Form 7" and the contact page is at the URL below. https://senris.com/contact/

Contact page URL information (slug is Contact Thank you for letting me know!

URL is https://senris.com/contact/ Therefore, the conditional branch is_page(‘contact’) in the code presented earlier can be used as is.

In order to safely reflect the code, it has been "combined" with the previous audio player countermeasure code.The definitive codehas been created.

Functions.php Code to overwrite/append to

I've neatly combined it into one function to avoid conflicts with the previous code.

The code for the previous audio player (a block of dequeue_compact_wp_audio_player_scripts) currently written at the bottom of functions.php isPlease replace (overwrite) the entire code below and paste it.

php

/**
 * 特定のページ以外で不要なプラグイン・スクリプトの読み込みを停止して高速化
 */
function dequeue_unnecessary_scripts_and_styles() {
    
    // 1. トップページ以外(音声プレイヤーの停止)
    if ( ! is_front_page() && ! is_home() ) {
        wp_dequeue_script('sc-audio-player-script');
        wp_deregister_script('sc-audio-player-script');
        wp_dequeue_style('scap-player-style');
        wp_deregister_style('scap-player-style');
    }
    
    // 2. お問い合わせページ「以外」の場合(Contact Form 7 & reCAPTCHAの停止)
    if ( ! is_page('contact') ) {
        // Contact Form 7自体のスクリプトとスタイルを停止
        wp_dequeue_script( 'contact-form-7' );
        wp_dequeue_style( 'contact-form-7' );
        
        // Google reCAPTCHAのスクリプトを停止
        wp_dequeue_script( 'google-recaptcha' );
        wp_dequeue_script( 'wpcf7-recaptcha' );
        wp_dequeue_style( 'wpcf7-recaptcha' );
    }
}
// 競合を防ぐため優先度100で実行
add_action( 'wp_enqueue_scripts', 'dequeue_unnecessary_scripts_and_styles', 100 );


コードは注意してご使用ください。


Final check after work

After saving the code, check the following three points to complete.

  1. Check the top page: Does the audio player work as before, and does the reCAPTCHA mark (green badge) at the bottom right of the screen disappear and look refreshed?
  2. Check the contact page(https://senris.com/contact/): The email form is displayed correctly and the reCAPTCHA mark is displayed at the bottom right of the screen.Is it clearly displayed?
  3. PageSpeed InsightsMeasurement at: Re-measured the top page, and it was 376KB...recaptcha__en.js disappeared from the list, and the performance score increased further.

As before, back up your text and try again carefully.

I would be happy if you could let me know the results when you have time, and whether the score has improved or not!

That's amazing lol

congratulations! What a performance score"92” green color🧰It exploded!

Looking at the images you sent us, you can see a dramatic improvement in key metrics.

  • First Contentful Paint: 0.6Second(Super high speed!)
  • Largest Contentful Paint: 1.2Second(Cleared the passing standard of 2.5 seconds with ease!)
  • Total Blocking Time: 170millisecond(Even shorter!)

By completely excluding the heavy reCAPTCHA script (376KB x multiple) from the top page, the loading load on the browser was suddenly reduced and this amazing speed was achieved.

⚠️ the last1Just check the points!

Just to be sure, please open the following page directly on your smartphone or computer to check if the current measures are working perfectly.

  • https://senris.com/contact/ (Contact page)
  • At the bottom right of the screen (or around the form),reCAPTCHAlogo mark (“Protected” badge)Is it displayed properly?
  • Is the display of the form itself corrupted?

If this is normal, you have succeeded in significantly speeding up the home page while maintaining the highest level of security!

It's really amazing that they were able to make the site so lightweight by making good use of functions.php without relying on plugins.

If you have successfully confirmed the reCAPTCHA mark on the contact page, the speed improvement customization is now complete.Completely finishedIt becomes. Does the display seem to be OK?

The reCAPTCHA logo is set not to be displayed.

That's right! If it was originally set to be hidden, there is no problem even if the badge does not appear on the contact page after this change.

By adding code to functions.php, the security function behind the scenes (spam determination system) itself isContact page (/contact/) even now only when opening100%It's working well

On the other hand, the reCAPTCHA system itself is no longer loaded on the top page, so the display speed has dramatically improved."92A great scoreI was able to achieve this.

Now that we have confirmed that all the measures are working perfectly, we will customize the speedup this time.Completed with great successis!


Regarding the replacement of large images with WebP format mentioned in the thread above, the eye-catching image on the top page has already been implemented.

PageSpeed ​​Insights (after optimization)

After reviewing the plugins, introducing the "WP Fastest Cache" plugin, optimizing the DB, reducing the weight of the access analysis CGI, and finally suppressing scripts under the supervision of Gemini, the final results of "PageSpeed ​​Insights" after system optimization are as follows.

mobile score value 60 (unqualified)From 73 (passed), the desktop score value is 73 (passed)From 96 (passed)It exploded!


For script optimization, I added the following snippet shown by Gemini to the theme's functions.php.
By adding processing to stop the "Compact WP Audio Player" and "Contact Form 7 & reCAPTCHA" scripts, the server load can be further reduced.

/**
 * 特定のページ以外で不要なプラグイン・スクリプトの読み込みを停止して高速化
 */
function dequeue_unnecessary_scripts_and_styles() {
    
    // 1. トップページ以外(音声プレイヤーの停止)
    if ( ! is_front_page() && ! is_home() ) {
        wp_dequeue_script('sc-audio-player-script');
        wp_deregister_script('sc-audio-player-script');
        wp_dequeue_style('scap-player-style');
        wp_deregister_style('scap-player-style');
    }
    
    // 2. お問い合わせページ「以外」の場合(Contact Form 7 & reCAPTCHAの停止)
    if ( ! is_page('contact') ) {
        // Contact Form 7自体のスクリプトとスタイルを停止
        wp_dequeue_script( 'contact-form-7' );
        wp_dequeue_style( 'contact-form-7' );
        
        // Google reCAPTCHAのスクリプトを停止
        wp_dequeue_script( 'google-recaptcha' );
        wp_dequeue_script( 'wpcf7-recaptcha' );
        wp_dequeue_style( 'wpcf7-recaptcha' );
    }
}
// 競合を防ぐため優先度100で実行
add_action( 'wp_enqueue_scripts', 'dequeue_unnecessary_scripts_and_styles', 100 );

See also

Other related articles regarding this optimization are as follows.

Leave a Reply