prefix table and plugins

I changed my prefix of my tables from the wp_ to something else for security reasons and good practice etc. I was curious most of new plugins installed take on the new prefix but I have one that refuses and still installs with wp_ it still works but i was curious is that normal practice or just a bad written plugin?

1 Answer
1

Short answer: Just a badly written plugin.

Longer answer: When a plugin calls the database in the right/correct/best practice way it uses Global $wpdb instead of just naming the database table, for example:

Wrong way

$sql = "SELECT * FROM wp_posts WHERE... "

Right way

$sql = "SELECT * FROM $wpdb->posts WHERE... "

this way it would work even if you change your tables prefix.

Leave a Comment