Global variables

item-feedback

#1

No we got a soft reject and one of the issues are the global variables.

@@@@@@
global variable should be used restrictively and only if theme really needs to.

Here’s an example how this would be acceptable: http://envato.d.pr/1aT9P/3ageodpz

My question do we need to use a function for global variables that comes with wp like $post and other


#2

$post is created automatically by WordPress, if you’re in a template file you don’t need to call this as global, only if you’re within function scope as your screenshot shows.


#3

Thanks for your reply, but the snapshot is what is been suggested by the reviewer to add global variables inside a function. But in some cases we arecalling $post and some other wp variables. My question do we need to create function for these variables also?!


#4

No suppose that we use woocommerce in some places like header where we should use like

Global woocommerce;

So do we have to create function for that as well??