Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aaa-option-optimizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*
* @package Progress_Planner\OptionOptimizer
*
* Plugin Name: AAA Option Optimizer
* Plugin Name: Autoload Optimizer
* Plugin URI: https://progressplanner.com/plugins/aaa-option-optimizer/
* Description: Tracks autoloaded options usage and allows the user to optimize them.
* Version: 1.6.1
* License: GPL-3.0+
* Author: Team Prospress Planner
* Author URI: https://prospressplanner.com/
* Author: Team Progress Planner
* Author URI: https://progressplanner.com/
* Text Domain: aaa-option-optimizer
*/

Expand Down
223 changes: 180 additions & 43 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,67 +1,174 @@
=== AAA Option Optimizer ===
=== Autoload Optimizer ===
Contributors: joostdevalk, aristath, filipi, progressplanner
Tags: options, database, cleanup
Requires at least: 6.7
Tags: autoload, options, database, performance, cleanup
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.6.1
License: GPL3+
Requires PHP: 7.4
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html

Plugin that tracks autoloaded options usage and allows the user to optimize them.
Find and fix bloated autoloaded options slowing down your WordPress database

== Description ==
This plugin tracks which of the autoloaded options are used on a page, and stores that data at the end of page render. It keeps an array of options that it has seen as being used. On the admin page, it compares all the autoloaded options to the array of stored options, and shows the autoloaded options that have not been used as you were browsing the site. If you've been to every page on your site, or you've kept the plugin around for a week or so, this means that those options probably don't need to be autoloaded.

=== How to use this plugin ===
Install this plugin, and go through your entire site. Best is to use it normally for a couple of days, or to visit every page on your site and in your admin manually. Then go to the plugin's settings screen, and go through the unused options. You can either decide to remove an unused option (they might for instance be for plugins you no longer use), or to set it to not autoload. The latter action is much less destructive: it'll still be there, but it just won't be autoloaded.
Every WordPress site loads dozens — sometimes hundreds — of autoloaded
options from the `wp_options` table on every single page request. Many of
those options belong to plugins you removed long ago, or simply don't need
to be autoloaded. The result: a bigger database query, slower page loads,
and wasted server resources.

**Autoload Optimizer** tracks which autoloaded options your site actually
uses, then shows you the ones it doesn't — so you can safely remove them
or turn off autoloading.

== How It Works ==

1. Install the plugin and browse your site normally for a few days.
2. The plugin quietly records which autoloaded options are actually used
during page rendering.
3. Visit the settings screen to see every autoloaded option that was
*never* used — and decide what to do with it.

You can **remove** unused options entirely (great for leftover data from
deactivated plugins) or **disable autoloading** for options that exist but
don't need to load on every request. Disabling autoloading is
non-destructive — the option stays in your database, it just won't be
fetched automatically.

== Features ==

- **Automatic usage tracking** — monitors which autoloaded options are
loaded on every page, on both the front end and in the admin.
- **Bulk actions** — optimize or delete multiple options at once instead
of one by one.
- **Known-plugin recognition** — identifies which plugin or theme each
option belongs to, so you know exactly what you're looking at.
- **"All Options" browser** — view and manage every option in your
`wp_options` table, not just the unused ones.
- **Source filtering** — filter options by their source plugin, theme, or
WordPress core to quickly find what you need.
- **Safe by design** — disabling autoload is non-destructive. You can
always re-enable it.
- **Lightweight** — the plugin's own tracking data is stored in a custom
database table for optimal performance.

== Why the "aaa" Slug? ==

WordPress loads plugins alphabetically. Because this plugin needs to start
tracking options as early as possible, the `aaa-option-optimizer` slug
ensures it loads first. It's not vanity — it's a technical requirement for
accurate measurement.

== Links ==

- [GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/)
— report bugs, contribute code, or browse the source.
- [Report a security vulnerability](https://patchstack.com/database/vdp/aaa-option-optimizer)
— via the Patchstack Vulnerability Disclosure Program.
- Built by the team behind
[Progress Planner](https://progressplanner.com/).

== Installation ==

= Automatic installation =

1. In your WordPress dashboard, go to **Plugins → Add New**.
2. Search for **Autoload Optimizer**.
3. Click **Install Now**, then **Activate**.
4. Browse your site normally for a few days — or visit every page
manually if you're in a hurry.
5. Go to **Tools → Option Optimizer** to review and optimize your
autoloaded options.

= Manual installation =

1. Download the plugin zip file.
2. Upload it via **Plugins → Add New → Upload Plugin**, or extract it
to `/wp-content/plugins/aaa-option-optimizer/` via FTP.
3. Activate the plugin through the **Plugins** menu.
4. Follow steps 4–5 above.

== Frequently Asked Questions ==

= Why the AAA prefix in the plugin name? =
= Will this plugin break my site? =

The safest action — disabling autoload — is non-destructive. The option
remains in your database and can still be loaded on demand. Deleting an
option is permanent, so only do that for options you're confident are no
longer needed (e.g., from plugins you've already removed). Always back up
your database before making bulk changes.

= Can I undo changes? =

Disabling autoload can be reversed from the "All Options" tab. Deleting
an option is permanent. If you need it back, you'll need to restore from
a database backup.

= How long should I wait before optimizing? =

Because the plugin needs to measure options being loaded, it benefits from being loaded itself first. As WordPress loads plugins alphabetically,
starting the name with AAA made sense.
A few days of normal browsing is usually enough. If you have a lot of
visitors, a few hours might even suffice. The goal is to visit every major
page on your site (front end and admin) so the plugin can record which
options are actually used. If you're thorough, you can start optimizing
sooner.

= Does this work with WordPress multisite? =

The plugin currently targets single-site installations. Multisite
compatibility has not been officially tested.

= How do I know which options are safe to remove? =

The plugin identifies the source of each option (which plugin, theme, or
WordPress core). If an option belongs to a plugin you've already
deactivated and removed, it's generally safe to delete. When in doubt,
disable autoloading instead of deleting — it's the safer choice.

= Do I need to take precautions? =

Yes!! Backup your database.
Yes, always back up your database before optimizing. Disabling autoload
is safe and reversible, but deleting options is permanent.

= Where can I report bugs? =

Please use [our GitHub](https://github.com/ProgressPlanner/aaa-option-optimizer/) for reporting bugs or making code suggestions. Feel free to use the forums for asking questions too, of course.

For security issues, please see the next question.
Please use [the GitHub repository](https://github.com/ProgressPlanner/aaa-option-optimizer/)
for bug reports and code suggestions. The WordPress.org support forum
works too for general questions.

= How can I report security issues? =

You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/aaa-option-optimizer)
Through the Patchstack Vulnerability Disclosure Program. The Patchstack
team validates, triages, and handles all security reports.
[Report a security vulnerability here.](https://patchstack.com/database/vdp/aaa-option-optimizer)

= How can I add recognized plugins? =
= How can I add my plugin to the known-plugins list? =

Please do a pull request via GitHub on [this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json) in the plugin.

== Installation ==
1. Search for AAA Option Optimizer on the repository.
2. Install the plugin.
3. Wait a week or so. Or, if you're in a hurry, click around on pages on your site, be sure to try and hit every page on your site and in your admin.
4. Go to the plugin's admin page and optimize your option usage.
Submit a pull request on GitHub to
[known-plugins.json](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json).

== Screenshots ==

1. Screenshot of the admin screen, initial tab.
2. Screenshot of the "All options" screen, showing you can browse all the options.
1. The main dashboard showing unused autoloaded options with their size,
source plugin, and action buttons.
2. The "All Options" tab lets you browse and manage every option in your
wp_options table.
<!-- TODO: add screenshot showing bulk actions in use -->
<!-- TODO: add screenshot showing the source filtering feature -->

== Changelog ==

= 1.6.1 =

* Fix infinite recursion in option access monitoring that could cause a fatal error in certain hosting environments.
* Fix infinite recursion in option access monitoring that could cause a
fatal error in certain hosting environments.

= 1.6.0
= 1.6.0 =

* Replace using 'all' filter for monitoring option usage with 'pre_option' filter for better performance.
* Migrate tracked options data from a single wp_option to a custom database table for improved performance and reliability.
* Replace using 'all' filter for monitoring option usage with
'pre_option' filter for better performance.
* Migrate tracked options data from a single wp_option to a custom
database table for improved performance and reliability.

= 1.5.1 =

Expand Down Expand Up @@ -104,42 +211,72 @@ Please do a pull request via GitHub on [this file](https://github.com/ProgressPl
Enhancements:

* Overhaul of the UX, implementing proper tabs, better buttons and more.
* Added a new "All options" tab, which, when you hit the button, loads all the options from the database and allows you to manage them.
* Added a new "All options" tab, which, when you hit the button, loads
all the options from the database and allows you to manage them.
* Added a "Reset data" button which resets the tracking data.
* Added a link to the Optimize Options page from the Plugins page.
* Much improved recognition of core WordPress options, themes and plugins under "Source", thanks in part to pull requests from [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/) and [system4pc](https://github.com/system4pc).
* You can now also filter all tables by Source so you can more easily find the options you're looking for.
* Many code and speed improvements under the hood, including adding a class autoloader and some i18n fixes.
* Much improved recognition of core WordPress options, themes and plugins
under "Source", thanks in part to pull requests from
[Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)
and [system4pc](https://github.com/system4pc).
* You can now also filter all tables by Source so you can more easily
find the options you're looking for.
* Many code and speed improvements under the hood, including adding a
class autoloader and some i18n fixes.

= 1.1.1 =

Implement the missing functionality to create an option with value `false` when it's being loaded but doesn't exist.
Implement the missing functionality to create an option with value
`false` when it's being loaded but doesn't exist.

= 1.1 =

The plugin now recognizes plugins from which the options came (thanks to a great pull by [Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)). If you're a plugin developer and want your plugin's options
properly recognized, please do a pull request [on this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json).
The plugin now recognizes plugins from which the options came (thanks to
a great pull by
[Rogier Lankhorst](https://profiles.wordpress.org/rogierlankhorst/)).
If you're a plugin developer and want your plugin's options properly
recognized, please do a pull request on
[this file](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/known-plugins/known-plugins.json).

Small enhancements:

* Column width is now automatically determined which leads to better spacing.
* Column width is now automatically determined which leads to better
spacing.
* Action buttons are now centered in their columns.

Bugs fixed:

* If you removed autoload from or deleted an option, it'd be removed from the table but would be back when you paginated, that's fixed - thanks to [Jono Alderson](https://profiles.wordpress.org/jonoaldersonwp/) for reporting.
* Fixed sorting by filesize by moving the `KB` to the table heading, so that you can now properly sort numbers.
* If you removed autoload from or deleted an option, it'd be removed
from the table but would be back when you paginated, that's fixed -
thanks to
[Jono Alderson](https://profiles.wordpress.org/jonoaldersonwp/)
for reporting.
* Fixed sorting by filesize by moving the `KB` to the table heading, so
that you can now properly sort numbers.
* Fixed issue where an empty option would result in weird size output.

= 1.0.2 =

* Fixed a bug where the buttons wouldn't work in a paginated state.
* Show the value of an option in a `popover`, as suggested with a great pull request by [@rogierlankhorst](https://profiles.wordpress.org/rogierlankhorst/).
* Show the value of an option in a `popover`, as suggested with a great
pull request by
[@rogierlankhorst](https://profiles.wordpress.org/rogierlankhorst/).

= 1.0.1 =

Fixed an error with values that are objects, not strings, which also caused sorting not to work for some people.
Fixed an error with values that are objects, not strings, which also
caused sorting not to work for some people.

= 1.0 =

Initial release on GitHub and WordPress.org.

== Upgrade Notice ==

= 1.6.1 =
Fixes a potential fatal error from infinite recursion in option
monitoring on certain hosts.

= 1.6.0 =
Performance and reliability: option tracking now uses a custom database
table instead of a single wp_option.
Loading