wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_wp_secrets_get_store › WordPress Function

Seit7.2.0
Veraltetn/v
› _wp_secrets_get_store ( Keine Parameter )
Gibt zurück:
  • (WP_Secrets_Store)
Definiert in:
Codex:

Returns the active secret store.

No filter is applied here, or anywhere on the retrieval path. See docs/spec/extension-points.md. A secrets.php drop-in overrides the store by setting $GLOBALS['wp_secrets_store'] to an instance before this is first called, and that global is checked here directly, not through a hook. If the global was set but is not a valid WP_Secrets_Store, or if the drop-in itself failed to load cleanly, this returns WP_Secrets_Broken_Store rather than silently using the default: the drop-in's presence signals the operator wants storage other than local options, and falling back to local options anyway would be the exact silent downgrade this API refuses to make.


Quellcode

function _wp_secrets_get_store(): WP_Secrets_Store {
	static $store = null;

	if ( $store instanceof WP_Secrets_Store ) {
		return $store;
	}

	if ( ! empty( $GLOBALS['wp_secrets_dropin_broken'] ) ) {
		$store = new WP_Secrets_Broken_Store();

		return $store;
	}

	if ( isset( $GLOBALS['wp_secrets_store'] ) && $GLOBALS['wp_secrets_store'] instanceof WP_Secrets_Store ) {
		$store = $GLOBALS['wp_secrets_store'];

		return $store;
	}

	$store = new WP_Secrets_Option_Store();

	return $store;
}