Global variables in WordPress?
-
I’ve done a lot of modifications to my WP site, mostly putting snippets of php code in widgets, pages, posts, and the nav bar. Most of these code snippets grab a GET variable from the URL, query a database to see if it matches something, and then depending on the query result changes what the snippet does to that part of the page.
It recently occurred to me that it would be really great if I could just do this once, instead of doing the exact same thing many times on the same page. Is there some place I could put my php code so that the result would be available to php code in any widget, post, page, or wordpress php file?
Thanks a lot for your advice 🙂
The topic ‘Global variables in WordPress?’ is closed to new replies.