Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
222037f
replace 'all' with 'pre_option' filter
ilicfilip Nov 25, 2025
b28eaf8
defined( 'WP_SETUP_CONFIG' )
ilicfilip Nov 25, 2025
ff64927
changelog
ilicfilip Nov 25, 2025
8acefba
WIP: add settings page
ilicfilip Nov 27, 2025
696fcfe
GitHub banner
jdevalk Dec 8, 2025
8d4896f
Add GitHub banner to README
jdevalk Dec 8, 2025
87ad4cf
Merge pull request #60 from ProgressPlanner/jdevalk-patch-1
jdevalk Dec 8, 2025
8df242f
Update image
jdevalk Dec 8, 2025
438bb40
Merge branch 'develop' into filip/replace-all-filter-settings-page
ilicfilip Dec 10, 2025
e27cc8f
Merge branch 'develop' into filip/replace-all-filter
ilicfilip Dec 10, 2025
1f7a2c0
Merge branch 'filip/replace-all-filter' into filip/replace-all-filter…
ilicfilip Dec 10, 2025
f21c6cb
move stats & reset button to the Settings page
ilicfilip Dec 10, 2025
dcb7765
Merge branch 'filip/replace-all-filter-settings-page' into filip/repl…
ilicfilip Dec 10, 2025
fbf8c9a
@return
ilicfilip Dec 10, 2025
b2603d9
change option order
ilicfilip Dec 10, 2025
8e5c5fd
delay get_option( 'option_optimizer' ) to 'shutdown'
ilicfilip Dec 10, 2025
168ff77
already set
ilicfilip Dec 10, 2025
0bc9aee
update data every 5 mins
ilicfilip Dec 10, 2025
8ba82cd
Bump "Tested up to" version to 6.9
ilicfilip Dec 11, 2025
7aa9288
hello custom table
ilicfilip Dec 11, 2025
66dd174
Apply suggestion from @aristath
aristath Dec 11, 2025
d3714b8
Merge pull request #62 from ProgressPlanner/filip/bump-wp-version
ilicfilip Dec 11, 2025
16a1ea9
Merge branch 'develop' into filip/new-data-structure
ilicfilip Dec 11, 2025
334cdb9
Merge branch 'develop' into filip/replace-all-filter
ilicfilip Dec 11, 2025
f76ad1b
move settings to new tab on plugin page
ilicfilip Dec 11, 2025
e04afeb
remove float: right; from the reset button
ilicfilip Dec 11, 2025
86c650c
change default to 'pre_option' (instead of 'legacy')
ilicfilip Dec 12, 2025
fdcfd13
change namespace
ilicfilip Dec 12, 2025
fddd0dc
update links and phpcs prefix
ilicfilip Dec 12, 2025
1fa44fb
Add new plugins and update option prefixes
jdevalk Dec 12, 2025
d08a4bb
Update known-plugins.json
jdevalk Dec 12, 2025
eb125ca
Update option prefixes for multiple plugins
jdevalk Dec 12, 2025
d80dba7
Add known plugins linting
jdevalk Dec 12, 2025
8ecf6da
Merge pull request #64 from ProgressPlanner/jdv/add-plugins
ilicfilip Dec 12, 2025
9414233
Merge pull request #59 from ProgressPlanner/filip/replace-all-filter
jdevalk Dec 12, 2025
56de6be
Fix credits
jdevalk Dec 13, 2025
81fdd44
Merge pull request #65 from ProgressPlanner/jdv/fix-credits
ilicfilip Dec 15, 2025
15df693
Merge branch 'develop' into filip/new-data-structure
ilicfilip Dec 18, 2025
f6cbdfa
merge count, dont replace
ilicfilip Dec 18, 2025
4bd187c
include all plugins, not just those available on first page load
ilicfilip Dec 18, 2025
7937cb0
fix composer package conflict
ilicfilip Dec 18, 2025
96152c9
update composer.lock
ilicfilip Dec 18, 2025
ee94c46
avoid PHP fatal error in case of downgrade
ilicfilip Dec 18, 2025
1272145
adjust migration condition
ilicfilip Dec 18, 2025
823971e
Merge pull request #69 from ProgressPlanner/filip/fix-composer
jdevalk Dec 19, 2025
c9bbfbf
Merge branch 'develop' into filip/new-data-structure
ilicfilip Dec 19, 2025
bc6dc26
composer.lock
ilicfilip Dec 19, 2025
ad54e71
one more prefix for phpcs
ilicfilip Dec 19, 2025
435c60b
now fix indend phpcs errors
ilicfilip Dec 19, 2025
1f18640
Merge pull request #66 from ProgressPlanner/filip/merge-options
aristath Dec 19, 2025
64758ba
Merge branch 'develop' into filip/fix-source-filter
ilicfilip Dec 19, 2025
328da19
make comparison consistent
ilicfilip Dec 19, 2025
a99ed15
Merge pull request #67 from ProgressPlanner/filip/fix-source-filter
aristath Dec 19, 2025
d877980
Merge branch 'develop' into filip/new-data-structure
ilicfilip Dec 19, 2025
c813a6e
split into chunks
ilicfilip Dec 19, 2025
39307c6
remove batch write, not needed with custom tables
ilicfilip Dec 22, 2025
90ea8bc
fix docblock and phpstan error
ilicfilip Dec 22, 2025
3e06c2f
prevent race conditions / sqlite lock errors
ilicfilip Dec 22, 2025
c8e4b9d
put back, for backwards compat
ilicfilip Dec 22, 2025
ae2daae
prevent triggering migration in parallel
ilicfilip Dec 22, 2025
491bf06
add ajax migration
ilicfilip Dec 22, 2025
75ec11d
phpstan fixes
ilicfilip Dec 22, 2025
92b0cb2
Merge pull request #63 from ProgressPlanner/filip/new-data-structure
jdevalk Feb 23, 2026
faae7d0
bump version & readme.txt
ilicfilip Mar 2, 2026
381997d
WP 7.0 compat
ilicfilip Mar 3, 2026
cd2fa8a
Merge pull request #70 from ProgressPlanner/filip/v1-6-0
ilicfilip Mar 3, 2026
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
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ jobs:

- name: Lint blueprint file
run: composer lint-blueprint

- name: Lint known plugins file
run: composer lint-known-plugins
Binary file added .wordpress-org/github_banner_aaaoo_pp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![CS](https://github.com/emilia-capital/aaa-option-optimizer/actions/workflows/cs.yml/badge.svg)](https://github.com/emilia-capital/aaa-option-optimizer/actions/workflows/cs.yml)
[![PHPStan](https://github.com/Emilia-Capital/aaa-option-optimizer/actions/workflows/phpstan.yml/badge.svg)](https://github.com/Emilia-Capital/aaa-option-optimizer/actions/workflows/phpstan.yml)
[![Lint](https://github.com/emilia-capital/aaa-option-optimizer/actions/workflows/lint.yml/badge.svg)](https://github.com/emilia-capital/aaa-option-optimizer/actions/workflows/lint.yml)
[![Security](https://github.com/emilia-capital/aaa-option-optimizer/actions/workflows/security.yml/badge.svg)](https://github.com/emilia-capital/aaa-option-optimizer/actions/workflows/security.yml)
[![CS](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/cs.yml/badge.svg)](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/cs.yml)
[![PHPStan](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/phpstan.yml/badge.svg)](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/phpstan.yml)
[![Lint](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/lint.yml/badge.svg)](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/lint.yml)
[![Security](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/security.yml/badge.svg)](https://github.com/ProgressPlanner/aaa-option-optimizer/actions/workflows/security.yml)

[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/aaa-option-optimizer.svg)](https://wordpress.org/plugins/aaa-option-optimizer/)
![WordPress Plugin: Tested WP Version](https://img.shields.io/wordpress/plugin/tested/aaa-option-optimizer.svg)
Expand All @@ -10,7 +10,9 @@
[![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/stars/aaa-option-optimizer.svg)](https://wordpress.org/support/plugin/aaa-option-optimizer/reviews/)
[![GitHub](https://img.shields.io/github/license/ProgressPlanner/aaa-option-optimizer.svg)](https://github.com/ProgressPlanner/aaa-option-optimizer/blob/main/LICENSE)

[![Try this plugin on the WordPress playground](https://img.shields.io/badge/Try%20this%20plugin%20on%20the%20WordPress%20Playground-%23117AC9.svg?style=for-the-badge&logo=WordPress&logoColor=ddd)](https://playground.wordpress.net/#%7B%22landingPage%22:%22/wp-admin/tools.php?page=aaa-option-optimizer%22,%22features%22:%7B%22networking%22:true%7D,%22steps%22:%5B%7B%22step%22:%22defineWpConfigConsts%22,%22consts%22:%7B%22IS_PLAYGROUND_PREVIEW%22:true%7D%7D,%7B%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22%7D,%7B%22step%22:%22installPlugin%22,%22pluginZipFile%22:%7B%22resource%22:%22url%22,%22url%22:%22https://bypass-cors.altha.workers.dev/https://github.com/Emilia-Capital/aaa-option-optimizer/archive/refs/heads/develop.zip%22%7D,%22options%22:%7B%22activate%22:true%7D%7D%5D%7D)
[![Try this plugin on the WordPress playground](https://img.shields.io/badge/Try%20this%20plugin%20on%20the%20WordPress%20Playground-%23117AC9.svg?style=for-the-badge&logo=WordPress&logoColor=ddd)](https://playground.wordpress.net/#%7B%22landingPage%22:%22/wp-admin/tools.php?page=aaa-option-optimizer%22,%22features%22:%7B%22networking%22:true%7D,%22steps%22:%5B%7B%22step%22:%22defineWpConfigConsts%22,%22consts%22:%7B%22IS_PLAYGROUND_PREVIEW%22:true%7D%7D,%7B%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22%7D,%7B%22step%22:%22installPlugin%22,%22pluginZipFile%22:%7B%22resource%22:%22url%22,%22url%22:%22https://bypass-cors.altha.workers.dev/https://github.com/ProgressPlanner/aaa-option-optimizer/archive/refs/heads/develop.zip%22%7D,%22options%22:%7B%22activate%22:true%7D%7D%5D%7D)

![GitHub banner](/.wordpress-org/github_banner_aaaoo_pp.png)

# AAA Option Optimizer
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.
Expand All @@ -24,7 +26,7 @@ Install this plugin, and go through your entire site. Best is to use it normally

### Why the AAA prefix in the plugin name?

Because the plugin needs to measure options being loaded, it benefits from being loaded itself first. As WordPress loads plugins alphabetically,
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.

### Do I need to take precautions?
Expand All @@ -33,7 +35,7 @@ Yes!! Backup your database.

### How can I add recognized plugins?

Please do a pull request via GitHub on [this file](https://github.com/Emilia-Capital/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json) in the plugin.
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.

### How can I report security bugs?

Expand Down
65 changes: 48 additions & 17 deletions aaa-option-optimizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/**
* Plugin that tracks autoloaded options usage and allows the user to optimize them.
*
* @package Emilia\OptionOptimizer
* @package Progress_Planner\OptionOptimizer
*
* Plugin Name: AAA Option Optimizer
* Plugin URI: https://joost.blog/plugins/aaa-option-optimizer/
* Plugin URI: https://progressplanner.com/plugins/aaa-option-optimizer/
* Description: Tracks autoloaded options usage and allows the user to optimize them.
* Version: 1.5.1
* Version: 1.6.0
* License: GPL-3.0+
* Author: Joost de Valk
* Author URI: https://joost.blog/
* Author: Team Prospress Planner
* Author URI: https://prospressplanner.com/
* Text Domain: aaa-option-optimizer
*/

Expand All @@ -27,12 +27,16 @@
register_deactivation_hook( __FILE__, 'aaa_option_optimizer_deactivation' );

/**
* Activation hooked function to store start stats.
* Activation hooked function to store start stats and create table.
*
* @return void
*/
function aaa_option_optimizer_activation() {
global $wpdb;

// Create the custom table.
Progress_Planner\OptionOptimizer\Database::create_table();

$autoload_values = \wp_autoload_values_to_autoload();
$placeholders = implode( ',', array_fill( 0, count( $autoload_values ), '%s' ) );

Expand All @@ -42,16 +46,23 @@ function aaa_option_optimizer_activation() {
);
// phpcs:enable WordPress.DB

update_option(
'option_optimizer',
[
'starting_point_kb' => ( $result->autoload_size / 1024 ),
'starting_point_num' => $result->count,
'starting_point_date' => current_time( 'mysql' ),
'used_options' => [],
],
false
);
// Only set starting point if not already set (preserve existing data).
$existing = get_option( 'option_optimizer' );
if ( empty( $existing['starting_point_date'] ) ) {
update_option(
'option_optimizer',
[
'starting_point_kb' => ( $result->autoload_size / 1024 ),
'starting_point_num' => $result->count,
'starting_point_date' => current_time( 'mysql' ),
'used_options' => [], // For backward compatibility.
'settings' => [
'option_tracking' => 'pre_option',
],
],
false
);
}
}

/**
Expand All @@ -64,13 +75,33 @@ function aaa_option_optimizer_deactivation() {
update_option( 'option_optimizer', $aaa_option_value, false );
}

/**
* Ensure database table exists.
* Runs on plugins_loaded to handle existing installs that don't trigger activation.
* Migration is handled via AJAX on the plugin admin page.
*
* @return void
*/
function aaa_option_optimizer_maybe_upgrade() {
// Only run on admin pages, not on AJAX or REST requests to avoid race conditions.
if ( ! is_admin() || wp_doing_ajax() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
return;
}

// Check if table exists, create if not.
if ( ! Progress_Planner\OptionOptimizer\Database::table_exists() ) {
Progress_Planner\OptionOptimizer\Database::create_table();
}
}
add_action( 'plugins_loaded', 'aaa_option_optimizer_maybe_upgrade' );

/**
* Initializes the plugin.
*
* @return void
*/
function aaa_option_optimizer_init() {
$optimizer = new Emilia\OptionOptimizer\Plugin();
$optimizer = new Progress_Planner\OptionOptimizer\Plugin();
$optimizer->register_hooks();
}

Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "emilia/aaa-option-optimizer",
"name": "progress-planner/aaa-option-optimizer",
"description": "Plugin that tracks autoloaded options usage and allows the user to optimize them.",
"type": "wordpress-plugin",
"license": "GPL-3.0-or-later",
Expand All @@ -16,7 +16,7 @@
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.3",
"phpstan/extension-installer": "^1.3",
"phpcompatibility/php-compatibility": "dev-develop as 9.99.99"
"phpcompatibility/php-compatibility": "^9.3"
},
"config": {
"allow-plugins": {
Expand All @@ -37,6 +37,9 @@
"lint-blueprint": [
"@php -r \"exit( intval( is_null( json_decode( file_get_contents( './.wordpress-org/blueprints/blueprint.json' ) ) ) ) );\""
],
"lint-known-plugins": [
"@php -r \"exit( intval( is_null( json_decode( file_get_contents( './known-plugins/known-plugins.json' ) ) ) ) );\""
],
"phpstan": [
"@php ./vendor/bin/phpstan analyse --memory-limit=2048M"
]
Expand Down
Loading