Title: Change gallery settings programmatically?
Last modified: September 15, 2023

---

# Change gallery settings programmatically?

 *  Resolved [Ingo Steinke (openmindculture)](https://wordpress.org/support/users/openmindculture/)
 * (@openmindculture)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/change-gallery-settings-programmatically/)
 * Instead of changing NextGEN Gallery settings in wp-admin, I want to set the same
   options programmatically, like using wp cli or an SQL command, , so that they
   can take effect when provisioning a WordPress instance using Ansible or Docker.
 * I compared `wp option list` before and after changing and saving gallery settings-
   > basic thumbnails, but I did not find the relevant diff in `ngg_options`.
 * What is the recommended way to set ngg gallery settings programmatically?

Viewing 1 replies (of 1 total)

 *  [Benjamin](https://wordpress.org/support/users/benjaminowens/)
 * (@benjaminowens)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/change-gallery-settings-programmatically/#post-17052855)
 * Hi [@openmindculture](https://wordpress.org/support/users/openmindculture/)!
 * You can change the display type settings programmatically by using NextGEN’s 
   API, like so:
 * $mapper = C_Display_Type_Mapper::get_instance();
   $display_type = $mapper->find_by_name(
   NGG_BASIC_THUMBNAILS);$display_type->settings[‘ajax_pagination’] = ‘1’;$mapper-
   >save($display_type);
 * That will find NextGEN’s custom post entry that stores the basic thumbnails attributes&
   settings, turn on the ajax pagination setting, and then save that entry back 
   to the DB.
 * Due to legacy issues it’s best if you save boolean options as a string, such 
   as ‘1’ for TRUE and ‘0’ for FALSE.
 * Let me know if you have any other questions!

Viewing 1 replies (of 1 total)

The topic ‘Change gallery settings programmatically?’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

## Tags

 * [cli](https://wordpress.org/support/topic-tag/cli/)
 * [docker](https://wordpress.org/support/topic-tag/docker/)
 * [settings](https://wordpress.org/support/topic-tag/settings/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)
 * [wp-cli](https://wordpress.org/support/topic-tag/wp-cli/)

 * 1 reply
 * 2 participants
 * Last reply from: [Benjamin](https://wordpress.org/support/users/benjaminowens/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/change-gallery-settings-programmatically/#post-17052855)
 * Status: resolved