A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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