$table_prefix used to be a global variable before it was deprecated in wordpress 2.1. Since then, we can use the $wpdb global variable to get the table prefix, as simple as $wpdb->prefix.
From wordpress codex page here:
…This value is found in the $wpdb->prefix variable. (If you’re developing for a version of WordPress older than 2.0, you’ll need to use the $table_prefix global variable, which is deprecated in version 2.1).
So, if you want to create a table called (prefix)liveshoutbox, the first few lines of your table-creation function will be:
function jal_install () {
global $wpdb;
$table_name = $wpdb->prefix . “liveshoutbox”;
}
Leave a Reply