WP Naming Conventions

PHP designers will make a whole class framework so as to maintain a strategic distance from impacts with capacities and variable names. In the event that you are new to the progressed OOP usefulness of PHP then it’s best to simply compose your code in test capacities.

So for our sample code we will compose a solitary capacity to house our information. We likewise need to characterize a couple of variables which are vital to actualize inside our format documents. The following is a case bit of code taken from our module document with the center rationale evacuated.

At the point when composing your example code it’s best to take after regulations and aides set up by WordPress. Since there are such a variety of interior capacities effectively characterized you can dodge copies by prefixing a name to every one of your variables and capacity names.


define(‘Webetutorial_FOLDER’, dirname(plugin_basename(__FILE__)));

define(‘Webetutorial_URL’, $siteurl.’/wp-content/plugins/’ . Webetutorial_FOLDER);

define(‘Webetutorial_FILE_PATH’, dirname(__FILE__));

define(‘Webetutorial_DIR_NAME’, basename(Webetutorial_FILE_PATH));


// this is the table prefix


global $wpdb;

global $siteurl;


define(‘Webetutorial_TABLE_PREFIX’, $Webetutorial_prefix);


Leave a Reply