WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have setup my plugin's table to use $wpdb->prefix but aside from that are there any conventions that you should name them;

Maybe $wpdb->prefix.'plugin_'.$tablename or something.

I can't find any documentation and the examples of plugins I have used in the past don't seem to adhere to anything in particular.

share|improve this question
You should use unique name. – Mohit Bumb Oct 11 '11 at 11:42
Thanks for your answer Mohit, a unique name is required, the table wouldn't create properly if you didn't use a unique name. – Toby Oct 11 '11 at 12:33
No its created but if old table exists then it update with your new table so maybe few functionality, plugin or any theme stop working or maybe full functionality too. – Mohit Bumb Oct 11 '11 at 12:38
up vote 3 down vote accepted

I'd say (and that's just my opinion), that prefixing global available stuff like:

  • functions
  • classes
  • tables
  • ...

should always share the same prefix. Aside from making your code more unique & therefore collision save, it helps when searching for plugin code, plus it serves as branding for your plugin too. Adding plugin_ to the table name seems like a valid and honorable idea, as it makes the Qs "Does it come from a theme, or a plugin? Where do I have to search for it?" obsolete.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.