• Resolved Smat Placid

    (@www_smatplacid_com)


    Hi Christoph,

    does it makes sense to create an import- / export-function?
    I know, not that many options yet, but if you “unbloat” on many sites it would be a time-saver.

    Kinda request ??

    Thank you, Roman

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author christophrado

    (@christophrado)

    I see the use-case, but it indeed seems a little overkill for Unbloater to have its own import/export section…

    All settings are stored in one wp_options field (unbloater_settings) though, so it’s quite easy to read/write those just about with any tool (PHP, or even CLI I guess).

    I personally use ManageWP and their Code Snippets feature to set stuff like this on multiple sites. Remotely configuring your sites might be a better approach than to log in to every site and import for each one.

    Thread Starter Smat Placid

    (@www_smatplacid_com)

    Thats a good hint! Installed ManageWP.
    Would you mind providing an code example?

    Thank you. Roman

    Plugin Author christophrado

    (@christophrado)

    The settings are basically stored as an array of options. You can read them from a site by running this:

    print_r( get_option( 'unbloater_settings' ) );

    Writing options should work along the lines of this:

    $settings = array(
    'remove_update_available_notice' => 1,
    'disable_auto_updates_core' => 0,
    ...
    );
    update_option( 'unbloater_settings', $settings );

    As of now, all of the options are checkboxes, so it’s only a matter of setting 0 (inactive) or 1 (active) for each option.

    Just make sure to include all of the options when saving the settings programmatically, otherwise they’ll be unset.

    Changing just one option on a site can be achieved like this:

    $settings = get_option( 'unbloater_settings' );
    $settings['disable_auto_updates_core'] = 0;
    update_option( 'unbloater_settings', $settings );

    That’s basically reading the current settings, changing a value and finally saving the changes to the database.

    Thread Starter Smat Placid

    (@www_smatplacid_com)

    Great – thank you. I appreciate this!

    Sch?nes Wochenende. Roman

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Import/ Export’ is closed to new replies.