Is it mandatory to use $wpdb->prefix in custom tables

It is mandatory, though it is not enforced.

Consider the scenario when two WordPress site has been setup in the same database. One with prefix wp_ and another with wp2_. If you install your plugin in both of the sites with the prefix, your created tables will be wp_liveshoutbox for first site and wp2_liveshoutbox for the second site. But if you omit the prefix, both of the site will be using the same table named liveshoutbox and the whole thing will break up.

Leave a Comment