In WordPress, you can use common variables across files by using PHP global variables in
header.php or
function.php
.
Specifically, the code is as follows
global $variable;.
This makes $variable
accessible within the subsequent scope. This is very useful when a variable needs to be shared among multiple functions or files.