PHPackages                             notus.sh/wp-static-options - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. notus.sh/wp-static-options

ActiveWordpress-muplugin

notus.sh/wp-static-options
==========================

Set WordPress and plugins options through configuration files instead of the wp\_options table.

1.1.2(5y ago)023Apache-2.0PHP

Since Sep 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/notus-sh/wp-static-options)[ Packagist](https://packagist.org/packages/notus.sh/wp-static-options)[ Docs](https://github.com/notus-sh/wp-static-options)[ RSS](/packages/notussh-wp-static-options/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (5)Used By (0)

wp-static-options
=================

[](#wp-static-options)

A WordPress plugin **for developers** to force strategic WordPress options through configuration files.

Why `wp-static-options`?
------------------------

[](#why-wp-static-options)

[WordPress](https://wordpress.org/) is well-known to be customizable through dozens of options and most plugins try to offer the same level of configurability. All options can be edited through WordPress Administration in a more or less organized and comprehensive way, depending on how many plugins you have, how complex they are and how thorough were plugin developers to follow [WordPress administration's guidelines](https://developer.wordpress.org/plugins/settings/).

It's great **and** it's a pain. Great because it allows people who know nothing about web technologies to publish their website (sometimes after some headaches). A pain because, as a project grows, you'll certainly end with some options that must definitely not be changed unless you want its public part to fall apart (or, at least, behave in unexpected ways).

Need examples? Just think about WordPress permalinks or WooCommerce payment gateways options and I think you'll get the point.

What does `wp-static-options`?
------------------------------

[](#what-does-wp-static-options)

`wp-static-options` allows you to set options once and for all in configuration files. It hooks into [WordPress's `get_option`](https://developer.wordpress.org/reference/functions/get_option/) to always return the right value (the one you want to be set).

Installation
------------

[](#installation)

### Using Composer

[](#using-composer)

`wp-static-options` works better when combined with [`roots/bedrock`](https://github.com/roots/bedrock) or a similar Composer setup for WordPress with [`composer/installers`](https://github.com/composer/installers) :

```
{
  // […]
  "require": {
    "composer/installers": "^1.8"
  },
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    }
  }
  // […],
}
```

Once your setup is correct, install this package via Composer:

```
composer require notus.sh/wp-static-options
```

### From sources

[](#from-sources)

Grab the latest tarball from [this repository releases' page](https://github.com/notus-sh/wp-static-options/releases) and extract it to your WordPress Must-Use plugins folder (defaults to `wp-content/mu-plugins`).

Usage
-----

[](#usage)

### Define your configuration directory

[](#define-your-configuration-directory)

`wp-static-options` expect a `STATIC_OPTIONS_DIR` constant to be defined and contain the path to your configuration directory as a string. You can define it in your `wp-config.php` (or `config/application.php` if you use Root's Bedrock).

If you don't define your own, a default value for `STATIC_OPTIONS_DIR` will be set to `WP_CONTENT_DIR . '/config/'`.

### Write your configuration files

[](#write-your-configuration-files)

`wp-static-options` will recursively load configuration files from `STATIC_OPTIONS_DIR` and merge them. Any file format supported by [`hassankhan/config`](https://github.com/hassankhan/config) is accepted. Feel free to split your configuration in as many files as you need (ex: one per plugin) and organise them the way you like.

For scalar options (whose values are integers, strings or numerically indexed arrays), add a top-level key to your configuration file and set the value:

```
timezone_string: 'Europe/Paris'
date_format: 'j F Y'
time_format: 'H:i'
```

Some plugins store their options as serialized arrays. You can set only values you really need to and let WordPress manage the others:

```
return [
  'woocommerce_stripe_testmode' => [
    'testmode' => (WP_ENV === 'production' ? 'yes' : 'no')
  ],
];
```

Caveats
-------

[](#caveats)

Du to [the way WordPress handle the return of `pre_option_*` filters](https://github.com/WordPress/WordPress/blob/master/wp-includes/option.php#L81), false booleans are not valid configuration values.

Contributing
------------

[](#contributing)

### Development environment

[](#development-environment)

You can use `dev/docker/Dockerfile` to build a lightweight local development environment with PHP 7.4 and Composer.

```
docker build                  \
  --build-arg USER_ID=$(id -u) \
  --build-arg GROUP_ID=$(id -g) \
  --tag php:dev                  \
  --file ./dev/docker/Dockerfile  \
  ./dev/docker/
```

Then run the container with :

```
docker run -it --rm --mount type=bind,source="$(pwd)"/,target=/home/runner/app --entrypoint /bin/bash php:dev
```

### Available Composer scripts

[](#available-composer-scripts)

Please use the available Composer scripts to validate your changes.

- `composer run tests`: Run unit and integration tests ([PHPUnit](https://github.com/sebastianbergmann/phpunit))
- `composer run tests-unit`: Run only unit tests
- `composer run tests-unit`: Run only integration tests
- `composer run lint`: Lint PHP code with [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
- `composer run phpmd`: Inspect PHP code with [PHP Mess Detector](https://github.com/phpmd/phpmd)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~40 days

Total

4

Last Release

1932d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/61d2c6c089e19477f73d3e4da4ee7c378c618e9b7ddea52809ee361ceae13f10?d=identicon)[notus.sh](/maintainers/notus.sh)

---

Top Contributors

[![gael-ian](https://avatars.githubusercontent.com/u/216617?v=4)](https://github.com/gael-ian "gael-ian (14 commits)")

---

Tags

phpwordpresswordpress-pluginwp-optionspluginwordpressbedrockmu-pluginmust-use

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/notussh-wp-static-options/health.svg)

```
[![Health](https://phpackages.com/badges/notussh-wp-static-options/health.svg)](https://phpackages.com/packages/notussh-wp-static-options)
```

###  Alternatives

[roots/bedrock-autoloader

An autoloader that enables standard plugins to be required just like must-use plugins

405.6M51](/packages/roots-bedrock-autoloader)[sybrew/the-seo-framework

An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.

47078.8k](/packages/sybrew-the-seo-framework)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[webdevstudios/cmb2-attached-posts

Custom field for CMB2 for creating post relationships.

13565.5k](/packages/webdevstudios-cmb2-attached-posts)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

263.7k1](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
