WPO

WordPress Optimize


Introduction

  • Name : WordPress Optimize
  • Current version : 1.0.0.0
  • Last update : 2025-03-17
  • Release date : 2025-03-17
  • Latest Change : Initial release.

Getting Started

Whenever you deploy the WPO script please pay attention to the server you are installing it to. The script is for sPanel and it DOES NOT work on cPanel. It DOES NOT work on shared servers.

Before running it, create a backup of the website (dump the database and copy over the files, e.g public_html > public_html_OLD

sPanel VPS

									curl https://wpoptimize.06082018.xyz/wpoptimize --output /scripts/wpoptimize; chmod +x /scripts/wpoptimize; /scripts/wpoptimize deploy 
									
								

How it works

The WordPress Optimize script is based on profiles.
Currently it supports only OpenLiteSpeed and only one profile (maximum_performance)
When ran, it will stop all conflicting plugins that may interfere with LiteSpeed-Cache.
Example ones: "w3-total-cache" , "wp-fastest-cache", "wp-super-cache", "speedycache", "speedycache-pro", "sg-cachepress", "docket-cache", "wp-cloudflare-page-cache", "wp-optimize"

What does it do and in what order?

1. It gathers all necessary information (wordpress version, plugin amount, document root, webserver status.. and so on)
- Once it's ready, it will ask you for confirmation if everything looks right to you.
2. It installs OpenLiteSpeed (in case it's not installed, if it is - this part is skipped)
3. It installs and configures Redis (in case it's not installed, if it is - this part is skipped)
4. It disables all conflicting plugins with LiteSpeed-Cache, because we don't want to create a mess.
4. Installs LiteSpeed-Cache
5. Imports our predefined profile with configurations
6. Applies all the custom changes that the LiteSpeed-Cache will generate in the htaccess directly within the VHOST as OLS does not read/comply with them.
7. Performs 4/4 CURL requests where we search for the "x-litespeed-cache" header. In case it's a "hit" - our job is done. In case it's "miss", it waits 5 seconds and sends another cURL request until we receive a "hit".
- If all 4/4 requests do not get a "hit", this means there's another problematic plugin that is not disabled and overrides the cache headers preventing the website from getting cached. In this case - we check manually.


Commands


Optimize a WordPress

/scripts/wpoptimize what user domain profile
- 'what' > the web server you want to use (currently only ols is supported)
- 'user' > the sPanel user where the domain resides in
- 'domain' > the domain of the website you want to optimize
- 'profile' > the name of the profile you want to use for the optimization
Example:

/scripts/wpoptimize ols emo saitanaemo.com maximum_performance.data

List all available OLS profiles

/scripts/wpoptimize list profiles
- Currently not used as we have only one profile -> "maximum_performance.data"

Example Output


In case everything went smooth and successful, you will see output similar to this one.

 
[root@server ~]# /scripts/wpoptimize ols testwp testwp.com maximum_performance.data

===== Optimization Request Received =====
User: testwp
Target: testwp.con
Optimization Profile: maximum_performance.data
===== ===== =====
Double-check the details above and if everything looks right, please confirm by typing Y
Y/N?y

=============================================================
=== Confirmation received, proceeding further ...
=============================================================
Found Version:  6.7.2
Latest Version:

[Info]  The current web server is Apache, after our checks we will install OpenLiteSpeed upon confirmation.
[Error] Redis is NOT installed, installing and configuring it first...
[Info]  Installing...
[Info]  Do note that you might see an error "Unable to find a match:", this is because some of the PHP extensions does 
not exist on Rocky 9 because we support PHP 7.4+ on it...
[OK]  Redis installed, now extensions .. proceeding further...
Error: Unable to find a match: php56-php-pecl-redis4 php70-php-pecl-redis5 php71-php-pecl-redis5 php72-php-pecl-redis6
[OK]  Redis' extensions installed, now configuration .. proceeding further...
[OK]  Redis' configuration done, installation completed!
[Info]  Creating a list of the current plugins for "/home/testwp/public_html" and organizing them for later...
[Info]  this process can take up to 2-3 minutes depending on the speed of the 'wp-cli'...
[Info]  Plugins found: 6
[Warning]  Outdated plugins detected!
>>> elementor - 3.27.7
[Warning] Conflicting plugins with "litespeed-cache" detected!
>>> wp-optimize
[Warning] These WILL be REMOVED if you proceed, ensure the customer is okay with it!


=============================================================
=== All information collected and ready to proceed with optimizing ...
=============================================================
Double-check the details above and if everything looks right, please confirm by typing Y
Y/N?y


=============================================================
=== Confirmation received, optimization is now in progress, do NOT close the console ...
=============================================================
[Info]  Installing OpenLiteSpeed...
[OK]  OpenLiteSpeed installed successfully, proceeding further...
[In Progress] Disabling all plugins that are not compatible with "litespeed-cache", wait for confirmation...
Disabling: wp-optimize
[OK]  LiteSpeed-Cache Installed.. activating..
[OK]  LiteSpeed-Cache Activated.. importing preset 'maximum_performance.data' ..
[OK]  The selected profile '/home/testwp/public_html/wp-content/plugins/litespeed-cache/data/preset/maximum_performance.data' 
exists, proceeding further...
[OK]  LiteSpeed-Cache preset imported successfully.. finalizing with the Expires headers and we are ready!
 'maximum_performance.data' ..
[OK]  (OLS VHOST) The rewrite rules were successfully updated to take effect of the LSCache!
==========================================================
[Info]  Now, we will perform several CURL requests to ensure 'x-litespeed-cache' returns 'hit'
URL: https://testwp.com
[Info]  cURL Attempt: 1/4
[Info]  Cache status: miss ,  1/4
[Info]  Retrying... 1/4
[Info]  cURL Attempt: 2/4
[Info]  Cache status: hit ,  2/4
[OK]  Cache is HIT, our job is done! :) .. 2/4

==========================================================
[OK]  The optimization is ready, please test the website and inform the customer! Profile used: 'maximum_performance' ...