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);


0 thoughts on “WP Naming Conventions”

Leave a Reply

Latest Article


Check Attachment Existence WordPress Tutorial

If you want to CHECK the same attachment name exists already before creating a new one or before inserting the attachment into the DB, you can use the following method: // check if attachment already Read more…


How to Create a Custom Page in WordPress

First, you need to open a text editorĀ  add the blank file add this line of code at the top: <?php /* Template Name: Custom Page Template */ ?> Editing Your Custom Page Template Your Read more…


How to add user profile image by custom URL and custom fields in woocommerce

If you want to add user profile image by custom URL and add custom fields of profile image like first name, last name in your woo-commerce registration form then see our code below, you can Read more…