Skip to content

Possible to extend settings from another plugin or theme? #15

Answered by jeffreyvr
stature asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! I think you could provide your own hook for that when registrering your settings.

Say you would register your default settings like this:

$settings = new WPSettings(__('My Plugin Settings'));

$tab = $settings->add_tab(__( 'General', 'textdomain'));

$section = $tab->add_section('Example');

$section->add_option('text', [
    'name' => 'example_option',
    'label' => __('Example option', 'textdomain')
]);

apply_filters('your_custom_plugin_settings', $settings);

$settings->make();

You could then allow plugins or themes to hook into your settings through the filter.

add_filter('your_custom_plugin_settings', function($settings) {
    // Add additional options here...
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@stature
Comment options

Answer selected by stature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants