I know its possible to auto install/activate plugins (on theme activation) via something like http://tgmpluginactivation.com/

What I want to know is if its possible to activate plugins and auto-setup their unique preferences?

For example, its possible to auto install the All in One SEO Pack plugin using the code above.

Is it also possible to have the plugin settings changed from disabled (default) to enabled - so it actually starts working right out of the box?

  • Could your plugin manage its own settings instead of using the Wordpress settings manager? You could just generate the things you need and keep them in the plugins tables or something like that? – Simon Forster Sep 6 '12 at 10:15

I've answered a similar Question ( Inherit plugin settings to new site in Multisite ).

And, if understood correctly, "auto setup their unique preferences" would be a matter of adding/updating a custom plugin options array into wp_options table.

So, following the WP-Pagenavi example. After the plugin auto install/activate run something like:
(not tested)

function set_my_plugin_options(){
    $defaults = array(
        'pages_text'                    => 'Page %CURRENT_PAGE% of %TOTAL_PAGES%',
        'current_text'                  => '%PAGE_NUMBER%',
        'page_text'                     => '%PAGE_NUMBER%',
        'first_text'                    => '« First',
        'last_text'                     => 'Last »',
        'prev_text'                     => '«',
        'next_text'                     => '»',
        'dotleft_text'                  => '...',
        'dotright_text'                 => '...',
        'num_pages'                     => 5,
        'num_larger_page_numbers'       => 3,
        'larger_page_numbers_multiple'  => 10,
        'always_show'                   =>,
        'use_pagenavi_css'              => 1,
        'style'                         => 1
    update_option( 'pagenavi_options', $defaults );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.