Categories
CMS Mastering Development Wordpress

Global variables and re-use

Currently I’m writing a WordPress plugin. I would try to re-use variables from a function on different pages. Let’s say I would create a function like this: function test() { global $hello; $hello = ‘hello world’; } add_action( ‘wp_head’, ‘test’ ); I can do now on other pages: echo $hello; This is useful for me […]