Title: Setting global in code
Last modified: December 8, 2017

---

# Setting global in code

 *  [Randy King](https://wordpress.org/support/users/randyking/)
 * (@randyking)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/setting-global-in-code/)
 * Great plugin, very clean. Is there a way to SET a variable that I have already
   defined programmatically? I need a variable that can change, depending on what
   page someone is viewing, so I need to be able to set it dynamically, not just
   once in the settings screen.
 * I have access to writing PHP code where I need to set the variable.

The topic ‘Setting global in code’ is closed to new replies.

 * ![](https://ps.w.org/custom-global-variables/assets/icon-256x256.png?rev=1415125)
 * [Custom Global Variables](https://wordpress.org/plugins/custom-global-variables/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-global-variables/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-global-variables/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-global-variables/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-global-variables/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Randy King](https://wordpress.org/support/users/randyking/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/setting-global-in-code/)
 * Status: not resolved