Unified Settings is the default operating mode for SLP settings from the 2612.*.* release series onward.
After cutover, the per-site WordPress option slp_settings_0001 is the sole source of truth for persisted settings across Store Locator Plus, Experience, Power, and Premier.
In multisite, this option belongs to the selected site’s options table.
SLP Settings Groups is future work for selecting and editing configurations in slp_settings_#### options. The current implementation uses slp_settings_0001 as the default.
Storage and ownership
slp_settings_0001holds one flat PHP array of globally unique setting slugs. It also holdsschema_versionand aninstalled_versionmap keyed bystore-locator-plus,experience,power, andpremieras available.slp_settings_0001_migrationholds completion flags and ownership metadata per module. An add-on claim such aspower.keys.hide_empty = truereserves the key for Power. A core claim such asstore-locator-plus.keys.searchlayout = csl-slplus-options_nojsidentifies the compatibility view that serves the key. The corresponding setting values live inslp_settings_0001.csl-slplus-options,csl-slplus-options_nojs,slp-experience,slp-power, andslp-premier-optionsremain logical option names. After cutover,get_option()calls for those names return filtered views of the unified row. Any physical rows under those names are historical snapshots. Read them directly only in the appropriate migration or audit path.- A SmartOption’s
use_in_javascriptflag selects its JS or no-JS runtime group. An add-on can declare and own the setting while the base plugin manages storage. Per-request values such ascity,country, andstatebelong in request handling.
Tenant loads and upgrades
SLP_SmartOptions::slp_specific_setup() loads settings after the caller has selected the tenant. The setup restores registered defaults, loads stored values through SLP_WPOption_Manager, and captures the save baseline for that site. Add-on registration runs on start_slp_specific_setup. Add-on option views refresh on finish_slp_specific_setup. WordPress also switches sites temporarily for calls such as get_blog_option(). Keep settings I/O and migrations out of switch_blog callbacks.
Authenticated upgrade entry points opt into slp_specific_setup( upgrade: true ). Completion state controls whether a module needs its one-time cutover, including a retry after an interrupted migration. Later package upgrades use SLP_Shared_Settings::record_installed_version() to update version metadata. Core also maintains csl-slplus-installed_base_version for the existing version checks.
Reads, writes, and Settings History
Use SmartOptions for effective values and SLP_WPOption_Manager for grouped reads and saves. SLP_Shared_Settings uses cached get_option() reads on the normal path. read_raw_option() bypasses WordPress filters when migration needs the original row and bypasses the cache where writes require fresh data or verification. When profiling, distinguish option API calls from actual SQL reads and check the current site at the call site.
The shared writer compares the submission with its per-site baseline, then merges changed keys into a fresh row under a per-site MySQL advisory lock. It checks ownership, preserves omitted keys and other modules’ values, and verifies the database write. Route saves through the manager so validation, ownership, and locking apply. Treat deletion as an explicit operation.
After a verified setting change, slplus_update_wp_option carries the logical option name, the saved settings, and the previous settings to MySLP_Settings_History::recordSettingsChange(). The callback runs synchronously while the write lock is held. Unchanged data, failed writes, migration copies, and version-only writes create no shared settings history. WordPress emits its native update_option_slp_settings_0001 action for updates to the physical row.
PHP to JavaScript
SLP_UI::localize_script() prepares the map settings after the slp_js_options filters and request overrides. WordPress attaches that payload to slp_core. In SaaS, MySLP_REST_API_Locations::get_options() takes the same prepared data through get_localized_script_data() and keeps the existing double-encoded options.data format for /wp-json/myslp/v2/locations-map.
Treat storage types and browser types as separate contracts. WordPress can persist a checkbox as the string "0". The browser expects use_sensor as a boolean and pagination_enabled as a string. SLP_Power_UI::modify_js_options() excludes registered SmartOptions from its legacy add-on merge so stored values cannot overwrite the prepared fields. Preserve explicit request overrides and review the intended public fields before changing the payload. Keep the full unified row internal.
Where to start a refinement
- Storage and ownership. Start in
store-locator-plus/include/module/wpoption/SLP_Shared_Settings.phpandSLP_WPOption_Manager.php. Check whether the key belongs to core or an add-on, which runtime group uses it, and whether the save path has a baseline for the current site. - Read performance. Start in
store-locator-plus/include/module/smartoptions/SLP_SmartOptions.php. Trace who callsslp_specific_setup()and why. Compare cold and warm option-cache behavior on a migrated site. Check that incidental site switches and repeat upgrades leave legacy rows alone. - Payload compatibility. Trace
store-locator-plus/include/module/ui/SLP_UI.php,slp-power/include/module/ui/SLP_Power_UI.php, andmyslp-dashboard/include/rest_api/MySLP_REST_API_Locations.php. Compare decoded keys and types through normal WordPress rendering and the SaaS map endpoint. Use identical seed data for exact value comparisons and preserve each environment’s values when comparing sites that have drifted. - Verification. Use WordPress 7.1.3. For write changes, verify that a changed save produces one history entry with the correct previous and saved values, an unchanged or failed save produces none, and one module’s save preserves settings owned by other modules.