Title: code snippet to update_options with array
Last modified: July 15, 2021

---

# code snippet to update_options with array

 *  [redrockbob](https://wordpress.org/support/users/redrockbob/)
 * (@redrockbob)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/code-snippet-to-update_options-with-array/)
 * I have an option that is an array. Is there any restriction for using the update_option
   in a run once snippet?
    Is there any concern in adding an element to the array
   before running the snippet? Is there any concern in removing an element (or renaming
   it) before running the snippet with the update_option(array) statment? Is there
   any concern if the option (array) that is being updated is loaded when WP starts
   up? Thanks in advance for sharing your knowledge and experience.
 * bob

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/code-snippet-to-update_options-with-array/#post-14745369)
 * There shouldn’t be any issue with these, except to say that I would recommend
   only including these statements in some sort of action hook such as `wp_loaded`
   or `init` instead of just running them directly in the snippet.

Viewing 1 replies (of 1 total)

The topic ‘code snippet to update_options with array’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/code-snippet-to-update_options-with-array/#post-14745369)
 * Status: not a support question