I have two functions which I’m hooking into a plugin. Both functions are called (at different times) during a single page creation by the server.
I want to set a flag in function_a which can be read by function_b.
Question: Is there any problem with just declaring my flag in the global scope? Is there a preferred WP-style for doing this?
ps. I realize that I will need to be defensive when function_b reads the flag–by making sure that the value was explicitly set, etc.
Uing OOP for your plugin it’s very easy.
Not using OOP you can use
global
variables.This works and seems easier, but first solution is better for sure.