Skip to content

perf: explicit option autoload flags (closes #22)#43

Merged
payown merged 1 commit into
mainfrom
fix/issue-22-option-autoload
Jun 16, 2026
Merged

perf: explicit option autoload flags (closes #22)#43
payown merged 1 commit into
mainfrom
fix/issue-22-option-autoload

Conversation

@payown

@payown payown commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Phase 4. Closes #22.

What

All plugin options were created without an explicit autoload value, so they all loaded on every request. Now:

  • Front-end-read options autoload yes: branding text/url, cache duration, brand account.
  • Admin/cron-only options autoload no: send hour/minute, from name/email, posts-per-digest, batch size, double opt-in, manage page id, db version, setup-wizard flag.

Fresh installs seed via add_option(..., $autoload); existing installs migrate once via wp_set_options_autoload() in maybe_upgrade() (db version bumped to 1.2.0). No behavior change for admins.

Verify

On an existing install, after a page load: the admin-only option keys are no longer in wp_load_alloptions() (or check the autoload column). Front-end feed/branding still render with no extra queries.

Closes #22

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 16, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates OutPost’s option creation/upgrade flow to set explicit autoload behavior so only front-end–needed options are loaded in alloptions, reducing unnecessary option loading overhead.

Changes:

  • Adds explicit autoload groupings and applies them on activation and during maybe_upgrade().
  • Switches default option seeding from update_option() to add_option(..., $autoload) to set autoload at creation time.
  • Bumps the internal schema/version option to 1.2.0 and extends upgrade logic to include option autoload tuning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/class-outpost-activator.php Outdated
Comment on lines +12 to +32
/** Options that are read on the front end and should autoload. */
const AUTOLOAD_YES = [
'outpost_branding_text',
'outpost_branding_url',
'outpost_cache_duration',
'outpost_brand_account',
];

/** Options only read in admin/cron and should NOT autoload. */
const AUTOLOAD_NO = [
'outpost_digest_send_hour',
'outpost_digest_send_minute',
'outpost_from_name',
'outpost_from_email',
'outpost_posts_per_digest',
'outpost_digest_batch_size',
'outpost_double_optin',
'outpost_manage_page_id',
'outpost_db_version',
'outpost_show_setup_wizard',
];
Front-end-read options autoload; admin/cron-only options do not. Fresh
installs seed via add_option() with the right autoload; existing installs
migrate once via wp_set_options_autoload() in maybe_upgrade() (db version
bumped to 1.2.0).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@payown payown force-pushed the fix/issue-22-option-autoload branch from 609cdee to 6008313 Compare June 16, 2026 17:15
@payown payown merged commit 40edd34 into main Jun 16, 2026
@payown payown deleted the fix/issue-22-option-autoload branch June 16, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: review autoload flag on plugin options

2 participants