aubreypwd / wpkickstart

A great way to kickstart a new WordPress plugin or project.
9 stars 0 forks source link

$app cannot be called that, it must be unique since it's global variable. #5

Closed aubreypwd closed 6 years ago

aubreypwd commented 6 years ago

https://github.com/aubreypwd/wp-plugin-boilerplate/blob/master/plugin-name.php#L24

Putting $app out in the global space does in fact make it global (not to the namespace). What that ends up doing is colliding with other plugins built on this structure. It needs to go in a static variable in the app() function. Or, it needs to be unique.

The second task above is so that you can use the below method to get to the app object:

global $app;
$app->thing->action();