Skip to content
Corex

LoadedOptions

Corex\Support\Options\LoadedOptions · class · Core layer

The options CoreX reads on every request, kept among the options WordPress loads with the site’s, so that reading one is no query (DECISIONS #366). An option stored with autoload off is a query each time a request first asks for it, and so is an option with no row, because WordPress remembers a missing option for one request only. A store whose option is read on every request registers it here, with the value that says nothing is stored, and writes it through {@see self::store()}. Nothing here answers for an option. A store goes on reading with get_option(), which is right for a row that is loaded, for one that is not, and for none: where a row is kept decides what a read costs and never what it answers.

register(string $option, mixed $nothingStored): void

Section titled “register(string $option, mixed $nothingStored): void”

Name an option that is read on every request.

Store an option’s value where WordPress loads it with the site’s options.

Turn over each registered option’s row that is not loaded, and write the row of one that has none. Only an admin or a cron request writes, as with the schema self-heal; once every row is loaded this asks the database nothing.