Skip to content

Instantly share code, notes, and snippets.

@thomasgriffin
Created October 5, 2011 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasgriffin/1265154 to your computer and use it in GitHub Desktop.
Save thomasgriffin/1265154 to your computer and use it in GitHub Desktop.
foreach issue
foreach ( $this->plugins as $plugin )
add_option( TGMPA_SETTINGS, array( "tgmpa_dismiss_{$plugin['slug']}" => 1 ) );
@GaryJones
Copy link

You're doing it wrong. Once add_option has added TGMA_SETTINGS once, it won't do anything else.

What you need to do is - loop through each dismissable value and add it to an array.
After the loop, pull get the current stored option value array.
Merge the arrays.
update_option() to store it all back in the DB.

@thomasgriffin
Copy link
Author

I figured I was doing it wrong - that always seems to be the case. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment