« Back to Glossary Index

A variable, in programming, is a named container used to store a value that can change while a program runs. Variables are among the most fundamental building blocks of essentially any programming language, PHP (WordPress's own language) included.

`$site_name = "Ferdy";` creates a variable called `$site_name` and stores the value "Ferdy" inside it — that stored value can then be reused or changed at any later point in the code.

  • They let code store and reuse specific values throughout a program
  • They make code considerably more flexible and adaptable
  • They allow the exact same code to work correctly with different inputs
  • They're genuinely essential for any kind of dynamic, changing content

WordPress's own core code relies extensively on PHP variables to manage everything from a post's actual content to a user's specific settings. Anyone writing custom code in functions.php, or building a custom plugin, will be working with variables constantly and directly.

« Back to Index
Share This