Created
October 5, 2011 17:54
-
-
Save thomasgriffin/1265154 to your computer and use it in GitHub Desktop.
foreach issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ( $this->plugins as $plugin ) | |
add_option( TGMPA_SETTINGS, array( "tgmpa_dismiss_{$plugin['slug']}" => 1 ) ); |
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
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.