Open abhishek-kaushik opened 4 years ago
I've come across the same issue as well. For more context, this is happening when trying to call get
inside of add_action( 'after_setup_theme'
Flags (both user- and site-level) aren't bootstrapped until early on the init
hook, so trying to check the flag status on after_setup_theme
isn't going to work.
I'm not sure why the bootstrap functions are being delayed until init
, other than that site flags code was copied from user flags, and users aren't authenticated until shortly before init
...
I think it would make more sense for site flags to run the HumanMade\Flags\Site\handle()
function when the flag is first registered. Thoughts?
@goldenapples Yep that's exactly what I saw when I first started looking into this. I think the solution makes sense.
Stumbled across this too.
When we are registering a site level flag. Flag status returns inactive even though flag is activated.
wp_options
table is updating correctly, might be something to do with how we are returningFlag
Object.