Title: Install plugin with preconfigurations
Last modified: December 2, 2016

---

# Install plugin with preconfigurations

 *  Resolved [shmulim](https://wordpress.org/support/users/shmulim/)
 * (@shmulim)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/install-plugin-with-preconfigurations/)
 * Hi, I’m installing this plugin on a series of websites and I want to avoid configuring
   it each time. I have tried to programmatically configure it in my code by setting
   the `model_post_gallery` option in the `wp_options` table. This is my code:
 *     ```
       update_option('model_post_gallery',
       	     '{ "can_enqueue": 0,
       	       "types": ["custom-post-type"],
                      "metabox_context": "advanced",
                      "metabox_priority": "default",
                      "ID": "post_gallery"
                      }',
                     true);
       ```
   
 * This returns unpredictable results though. While it changes the options checkbox
   display, it doesn’t necessarily have an effect on which post types the gallery
   metabox will show. Is there a better way to programmatically configure the plugin?
   Thanks!
    -  This topic was modified 9 years, 6 months ago by [shmulim](https://wordpress.org/support/users/shmulim/).
      Reason: code

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [10Quality](https://wordpress.org/support/users/10quality/)
 * (@10quality)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/install-plugin-with-preconfigurations/#post-8935905)
 * Hi shmulim!
 * Yes, there is a better way to change settings from code. Simply call to the settings
   class and save the custom settings. Make sure the plugin is installed and activated
   before doing this though.
 * Sample:
    [https://gist.github.com/amostajo/53aa1c5ffa00063cf65bded85ee9b80f](https://gist.github.com/amostajo/53aa1c5ffa00063cf65bded85ee9b80f)

Viewing 1 replies (of 1 total)

The topic ‘Install plugin with preconfigurations’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-post-gallery_b2b9e1.svg)
 * [Post Gallery](https://wordpress.org/plugins/simple-post-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-post-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-post-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-post-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-post-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-post-gallery/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [10Quality](https://wordpress.org/support/users/10quality/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/install-plugin-with-preconfigurations/#post-8935905)
 * Status: resolved