wp_lib_plugin_settings - roberts-sandbox/create-repo GitHub Wiki

###Description This filter allows developers to add their own settings to WP-Librarian's registered settings. This allows settings to be registered via WP_LIB_SETTINGS_SECTION, WP-Librarian's class for handling settings and their associated sections/fields.

###Context

This hook is called from admin_init, just before WP-Librarian registers it's settings sections, settings and settings fields.

###Parameters

$settings
An array of settings stored as $key => $default where $key is the name of the option and $default is its default value. The default value is used to replace the option if it becomes invalid. WP-Librarian expects settings to always be an array.

Note: If you're wondering what all this malarkey is about options, setting and settings sections then check out the settings guide.

###Example

Supposed I want a settings section as a tab on WP-Librarian's settings page and to use the WP_LIB_SETTINGS_SECTION class to handle rendering my settings fields. This code would allow my setting to be registered via WP_LIB_SETTINGS_SECTION:


add_filter('wp_lib_plugin_settings', 'add_my_settings');

function add_my_settings(Array $settings) {
	$settings['my_setting'] = array('default value', 'second default value');
	
	return $settings;
}

⚠️ **GitHub.com Fallback** ⚠️