jrbarnard / wp-config

MU plugin to help with Wordpress config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wordpress - Config helper

A simple mu-plugin, provides a static config class for handling Wordpress config globals.

Usage

Add into wp-content/mu-plugins directory.

In the custom plugin that will use it:

JbConfig::defined('SOME_GLOBAL'); // false

define('SOME_GLOBAL', 'test');

JbConfig::defined('SOME_GLOBAL'); // true

JbConfig::get('SOME_GLOBAL'); // 'test'
JbConfig::get('SOME_UNDEFINED_GLOBAL', 'default value'); // 'default value'

Currently it only supports defined globals but there's scope for being able to swap out the config driver (e.g if using a .env file), and potentially setter methods etc.

About

MU plugin to help with Wordpress config


Languages

Language:PHP 100.0%