[wp-trac] [WordPress Trac] #45861: Global variable in plugin main file

WordPress Trac noreply at wordpress.org
Mon Jun 23 09:25:50 UTC 2025


#45861: Global variable in plugin main file
------------------------------------+------------------------------
 Reporter:  rilwis                  |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Plugins                 |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+------------------------------

Comment (by callumbw95):

 Hi @rilwis,
 Just having a look at this as its been a few years, but I wonder if there
 is a reason to not do this. For example in some cases I can see reason for
 plugins to expose variables globally, but also I imagine some plugins will
 work in conjunction with variables from other plugins. However if a plugin
 developer wanted to obscure their variables, then they can do this within
 the plugin and wrapping their functionality within a function/class.
 Such a sweeping change like this could potentially break the functionality
 of a wide range of plugins, and I personally would advise against this.
 However I think this requires further developer input to discuss.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45861#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list