Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

In PHP globals are variables that are available for every function. WordPress core defines several handfulls of global variables, such as `$post` and `wp_query`.

In PHP globals are variables that are available for every function. WordPress core defines several handfulls of global variables, such as $post and wp_query.

Note that global variables must be declared inside every function that uses them, unless they are passed as a parameter. It is good coding practice to avoid global variables as much as possible.

history | excerpt history